/// <summary> /// 设置开始状态 /// </summary> /// <param name="state"></param> public void SetStartState(PEIState state, params object[] parameters) { if (_curState == null) { if (_allStates.ContainsValue(state)) { _curState = state; _curState.OnEnter(parameters); } } }
/// <summary> /// 设置开始状态 /// </summary> /// <typeparam name="T"></typeparam> public void SetStartState <T>(params object[] parameters) where T : PEIState { if (_curState == null) { int hashCode = typeof(T).GetHashCode(); if (_allStates.ContainsKey(hashCode)) { _curState = _allStates[hashCode]; _curState.OnEnter(parameters); } } }