Пример #1
0
    public void ChangeState(HomeStateCode eState)
    {
        Type type = Type.GetType("HomeState." + eState.ToString());

        if (type == null)
        {
            return;
        }
        HomeStateBase homeStateBase = Activator.CreateInstance(type) as HomeStateBase;

        if (homeStateBase == null)
        {
            return;
        }
        this._nextState = homeStateBase;
    }
Пример #2
0
 public void OnUpdate()
 {
     if (!this.enable)
     {
         return;
     }
     if (this._nextState != null)
     {
         if (this._curState != null)
         {
             this._curState.OnExit();
         }
         this._curState = this._nextState;
         if (this._curState != null)
         {
             this._curState.OnEnter();
             this._nextState = null;
         }
     }
     if (this._curState != null)
     {
         this._curState.OnUpdate(0L);
     }
 }
Пример #3
0
 public void OnAwake()
 {
     HomeManager.m_instance = this;
     this._curState         = null;
     this._nextState        = null;
 }