Class BossScriptState
Per-NPC runtime state for a BossScript. Tracks the current phase index, timed mechanic timers, and handles phase transitions and mechanic activations.
This is a plain C# class (not a ScriptableObject) because it holds mutable state that differs per NPC instance — the same BossScript asset may be shared across multiple boss spawns.
public class BossScriptState
- Inheritance
-
BossScriptState
- Inherited Members
Constructors
BossScriptState(BossScript)
public BossScriptState(BossScript script)
Parameters
scriptBossScript
Properties
CurrentPhase
Returns the current BossPhase, or null if no phases are configured.
public BossPhase CurrentPhase { get; }
Property Value
CurrentPhaseIndex
Current phase index into Phases.
public int CurrentPhaseIndex { get; }
Property Value
Initialized
True if this state has been initialized.
public bool Initialized { get; }
Property Value
Script
The asset defining phases and mechanics.
public BossScript Script { get; }
Property Value
Methods
EvaluatePhases(AIController)
Evaluates phase transitions based on current HP. Returns true if a phase change occurred. Call once per AI tick.
public bool EvaluatePhases(AIController controller)
Parameters
controllerAIControllerThe boss NPC's AI controller.
Returns
- bool
True if a phase transition happened this tick.
Reset()
Resets the boss to phase 0 and resets all mechanic timers. Called on leash or despawn.
public void Reset()
TickMechanics(AIController, float)
Ticks all active timed mechanics for the current phase. Call once per AI tick with the delta time.
public void TickMechanics(AIController controller, float deltaTime)
Parameters
controllerAIControllerThe boss NPC's AI controller.
deltaTimefloatTime since last tick.