예제 #1
0
        /// <summary>
        /// 返回上一个状态
        /// </summary>
        public virtual void RestorePreviousState()
        {
            CurrentState = PreviousState;

            if (TriggerEvents)
            {
                TypeEventSystem.Send(new EnumStateChangeEvent <T>(this));
            }
        }
예제 #2
0
        /// <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));
            }
        }
예제 #3
0
 public void SendEvent <TEvent>() where TEvent : new()
 {
     mTypeEventSystem.Send <TEvent>();
 }