//转换状态 public void TransitionFSMState(FSMTransition transition) { FSMStateID stateID = myState.GetStateIdByTransition(transition); if (stateID != FSMStateID.NullFSMStateID) { myStateID = stateID; myState.StateEnd(); //换状态 myState = myStateDic.FirstOrDefault(q => q.Key == stateID).Value; myState.StateStart(gameObject); } }
public void AddFSMState(FSMBaseState state) { if (state == null) { Debug.Log("角色状态为空,无法添加"); return; } if (myState == null) { //第一个添加的状态被作为系统首个运行的状态 myStateID = state.myStateID; myState = state; myState.StateStart(gameObject); } if (myStateDic.ContainsValue(state)) { Debug.Log("容器内存在该状态"); return; } myStateDic.Add(state.myStateID, state); }
public void AddFSMSate(FSMBaseState state) { if (state == null) { Debug.Log("角色状态为空,无法添加"); return; } if (mCurrentState == null) { //第一个添加的状态被作为系统首个运行的状态 mCurrentStateID = state.mStateID; mCurrentState = state; mCurrentState.StateStart(); } if (mFSMStateDic.ContainsValue(state)) { //Debug.Log("容器内存在该状态"); return; } mFSMStateDic.Add(state.mStateID, state); }