/// <summary> /// 返回上一个状态 /// </summary> public virtual void RestorePreviousState() { CurrentState = PreviousState; if (TriggerEvents) { TypeEventSystem.Send(new EnumStateChangeEvent <T>(this)); } }
/// <summary> /// 切换状态 /// </summary> /// <param name="newState">New state.</param> public virtual void ChangeState(T newState) { // if the "new state" is the current one, we do nothing and exit if (newState.Equals(CurrentState)) { return; } // we store our previous character movement state PreviousState = CurrentState; CurrentState = newState; if (TriggerEvents) { TypeEventSystem.Send(new EnumStateChangeEvent <T>(this)); } }
public void SendEvent <TEvent>() where TEvent : new() { mTypeEventSystem.Send <TEvent>(); }