Beispiel #1
0
 protected virtual void Awake()
 {
     foreach (TriggerStatusState state in states)
     {
         TriggerStatusState instance = Instantiate(state);
         instance.Initialize(this);
         stateDictionary.Add(instance.GetType(), instance);
         if (currentState == null)
         {
             currentState = instance;
         }
     }
     currentState.Enter();
 }
Beispiel #2
0
 public void Transition <T>() where T : TriggerStatusState
 {
     currentState.Exit();
     currentState = stateDictionary[typeof(T)];
     currentState.Enter();
 }