A StageEvent subclass that triggers a miniboss spawn. On Start it plays a UI sound, posts a local chat message, and if running on the host it spawns a miniboss at a random spawn position, then removes the event.
using System;
using System.Drawing;
using System.Reflection;
using Sandbox;
public class StageEventMiniboss : StageEvent
{
public override void Start( int randSeed )
{
base.Start( randSeed );
Manager.Instance.PlaySfxUIRpc( "miniboss_spawn", pitch: Game.Random.Float( 0.95f, 1.05f ), volume: 0.8f );
Manager.Instance.Chat.AddLocalChatMessage( "A miniboss has spawned!", from: "" );
if ( Networking.IsHost )
{
Manager.Instance.SpawnMiniboss( Manager.Instance.GetRandomSpawnPos() );
}
Manager.Instance.RemoveEvent( EventType );
}
}