protected virtual void UpdateNextState() { if (m_info.nextState == null) { if (!m_stateMgr.role.AnmationMgr.isPlaying) { AfterAction(); } } else { foreach (int type in m_info.nextState) { CState state = null; if (m_parent == null) { state = m_stateMgr.getStateByType(type); if (state != null && state.check(this)) { if (m_stateMgr.ChangeToState(type)) { return; } } } else { if (type == SUBSTATE_END) { if (!m_stateMgr.role.AnmationMgr.isPlaying) { m_parent.AfterAction(); } } else { state = m_parent.GetSubStateByType(type); if (state != null && state.check(this)) { if (m_parent.ChangeToSubState(type)) { return; } } } } } } }
protected bool ChangeToSubState(int type) { CState state = null; if (!m_mapSubState.TryGetValue(type, out state)) { return(false); } if (m_subState != null) { m_subState.AfterAction(); } m_subState = state; if (m_subState.hash != 0) { m_stateMgr.role.AnmationMgr.Play(m_subState.hash); } m_subState.PreAction(); return(true); }
public bool ChangeToState(int StateType) { CState state = null; if (!m_mapState.TryGetValue(StateType, out state)) { return(false); } if (m_state != null) { m_state.AfterAction(); } m_lastState = m_state; m_state = state; if (m_state.hash != 0) { m_life.AnmationMgr.Play(m_state.hash); } m_state.PreAction(); return(true); }