public void DeleteTransition(BullDemonKingTransition trans) { if (mMap.ContainsKey(trans) == false) { Debug.LogError("删除转换条件的时候, 转换条件:[" + trans + "]不存在"); return; } mMap.Remove(trans); }
public BullDemonKingStateID GetOutPutState(BullDemonKingTransition trans) { if (mMap.ContainsKey(trans) == false) { return(BullDemonKingStateID.NullState); } else { return(mMap[trans]); } }
public void AddTransition(BullDemonKingTransition trans, BullDemonKingStateID id) { if (trans == BullDemonKingTransition.NullTransition) { Debug.LogError("BullDemonKingState Error: trans不能为空"); return; } if (id == BullDemonKingStateID.NullState) { Debug.LogError("BullDemonKingState Error: 状态ID不能为空"); return; } if (mMap.ContainsKey(trans)) { Debug.LogError("BullDemonKingState Error: " + trans + " 已经添加上了"); return; } mMap.Add(trans, id); }
public void PerformTransition(BullDemonKingTransition trans) { if (trans == BullDemonKingTransition.NullTransition) { Debug.LogError("要执行的转换条件为空:" + trans); return; } BullDemonKingStateID nextStateID = mCurrentState.GetOutPutState(trans); if (nextStateID == BullDemonKingStateID.NullState) { Debug.LogError("在转换条件[" + trans + "]下,没有对应的转换状态"); return; } foreach (IBullDemonKingState s in mStates) { if (s.stateID == nextStateID) { mCurrentState.DoBeforeLeaving(); mCurrentState = s; mCurrentState.DoBeforeEntering(); return; } } }