예제 #1
0
 void NPC_AI_Died(GameObject deadUnit, UnitDiedEventArgs e)
 {
     Destroy(this);
     if (deadUnit)
     {
         Util.Destroy(deadUnit.GetComponents<NPC_BehaviorState>());
         currentState = null;
     }
 }
예제 #2
0
 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;
         }
     }
 }
예제 #3
0
 public void SetInitialState(NPC_BehaviorState behavior)
 {
     this.currentState = behavior;
     currentState.Enable();
 }