void NPC_AI_Died(GameObject deadUnit, UnitDiedEventArgs e) { Destroy(this); if (deadUnit) { Util.Destroy(deadUnit.GetComponents<NPC_BehaviorState>()); currentState = null; } }
private void TransitionState() { foreach (StateTransition transition in currentState.transitions) { //should probably prioritize states with a value of some sort if (transition.CanTransition()) { currentState.Disable(); currentState = transition.nextState; currentState.Enable(); return; } } }
public void SetInitialState(NPC_BehaviorState behavior) { this.currentState = behavior; currentState.Enable(); }