//执行新状态 public void ExcuteNewState(TLabel newState) { if (!_stateDic.ContainsKey(newState)) { DebugMsg.LogError("状态机内不包含此状态对象:" + newState); return; } _previousState = _currentState; _currentState = _stateDic[newState]; if (_previousState != null) { _previousState.Exit(); } if (_currentState != null) { _currentState.Enter(); } }
public void ChangeState(IFsmState newState) { _currentEvent?.Exit(); _currentEvent = newState; _currentEvent.Start(); }