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

            if (TriggerEvents)
            {
                TypeEventSystem.Send(new EnumStateChangeEvent <T>(this));
            }
        }
Esempio n. 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));
            }
        }
Esempio n. 3
0
 public static void UnRegisterEvent <T>(this IOnEvent <T> self) where T : struct
 {
     TypeEventSystem.UnRegister <T>(self.OnEvent);
 }
 public void Dispose()
 {
     TypeEventSystem.UnRegister(OnReceive);
 }
Esempio n. 5
0
 public static IDisposable RegisterEvent <T>(this IOnEvent <T> self) where T : struct
 {
     return(TypeEventSystem.Register <T>(self.OnEvent));
 }