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(); }
public void Transition <T>() where T : TriggerStatusState { currentState.Exit(); currentState = stateDictionary[typeof(T)]; currentState.Enter(); }