Beispiel #1
0
 public virtual void SetState(BattleStateIndex state)
 {
     m_prevState = m_currState;
     m_currState = m_states[(int)state];
     if (null != m_prevState)
     {
         m_prevState.Exit();
     }
     m_currState.Enter();
 }
Beispiel #2
0
    public void Init()
    {
        BattleStateMachine state = null;

        for (BattleStateIndex index = BattleStateIndex.None + 1; index < BattleStateIndex.Max; ++index)
        {
            Util.CreateInstanceToString <BattleStateMachine>(ref state, string.Format("{0}State", index.ToString()));
            state.Init(index);
            m_states[(int)index] = state;
        }
    }
Beispiel #3
0
    public bool IsPrevState(BattleStateIndex state)
    {
        if (null == m_prevState)
        {
            return(false);
        }

        if (m_prevState.GetStateIndex() == state)
        {
            return(true);
        }

        return(false);
    }
Beispiel #4
0
 public virtual void Init(BattleStateIndex stateIndex)
 {
     m_stateIndex = stateIndex;
 }