Ejemplo n.º 1
0
    /*状态改变*/
    public void ChangeGlobalState(CState <entity_type> pNewState)
    {
        if (pNewState == null)
        {
            Debug.LogError("can't find this state");
        }

        if (pNewState != m_pGlobalState)
        {
            //触发退出状态调用Exit方法
            m_pGlobalState.Exit(m_pOwner);
            //设置新状态为当前状态
            m_pGlobalState        = pNewState;
            m_pGlobalState.Target = m_pOwner;
            //进入当前状态调用Enter方法
            m_pGlobalState.Enter(m_pOwner);
        }
    }
Ejemplo n.º 2
0
 public void ChangeState(CState <entity_type> pNewState, bool IsEnd)
 {
     if (pNewState == null)
     {
         Debug.LogError("can't find this state");
     }
     if (IsEnd == true)
     {
         if (pNewState != m_pCurrentState)
         {
             //触发退出状态调用Exit方法
             m_pCurrentState.Exit(m_pOwner);
             //保存上一个状态
             m_pPreviousState = m_pCurrentState;
             //设置新状态为当前状态
             m_pCurrentState        = pNewState;
             m_pCurrentState.Target = m_pOwner;
             //进入当前状态调用Enter方法
             m_pCurrentState.Enter(m_pOwner);
         }
     }
 }
Ejemplo n.º 3
0
 /*设置当前状态*/
 public void SetCurrentState(CState <entity_type> CurrentState)
 {
     m_pCurrentState        = CurrentState;
     m_pCurrentState.Target = m_pOwner;
     m_pCurrentState.Enter(m_pOwner);
 }
Ejemplo n.º 4
0
 /*设置全局状态*/
 public void SetGlobalStateState(CState <entity_type> GlobalState)
 {
     m_pGlobalState        = GlobalState;
     m_pGlobalState.Target = m_pOwner;
     m_pGlobalState.Enter(m_pOwner);
 }
Ejemplo n.º 5
0
 /*进入全局状态*/
 public void GlobalStateEnter()
 {
     m_pGlobalState.Enter(m_pOwner);
 }