public FSMBaseAction(E_ActionTYpe type, Agent agent, FSMManager owner) { _actionType = type; _agent = agent; _owner = owner; Initialize(); }
public FSMManager(Agent agent, E_ActionTYpe defaultAction) { _agent = agent; _defaultAction = defaultAction; _isStop = false; _isTransform = true; }
/// <summary> /// 添加Action 切换关系 /// </summary> /// <param name="nowState">前一个状态</param> /// <param name="nextState">下一个状态</param> /// <param name="preconditions">过度条件</param> /// <param name="priority">优先级</param> public void AddRelation(E_ActionTYpe nowState, E_ActionTYpe nextState, FSMWorldState preconditions, int priority) { if (_actionSet.ContainsKey(nowState) && _actionSet.ContainsKey(nextState)) { FSMSubsequenceAction subAction = new FSMSubsequenceAction(_actionSet[nextState], preconditions, priority); if (!_nextActions.ContainsKey(nowState)) { _nextActions.Add(nowState, new List <FSMSubsequenceAction>()); } _nextActions[nowState].Add(subAction); } }
private static FSMBaseAction CreateAction(E_ActionTYpe type, Agent agent, FSMManager owner) { switch (type) { case E_ActionTYpe.Idle: return(new PlayerIdleAction(agent, owner)); case E_ActionTYpe.Walk: return(new PlayerWalkAction(agent, owner)); //case E_ActionTYpe.Attack: // break; default: Debug.LogError("No this Action"); return(null); } }
public static FSMBaseAction Create(E_ActionTYpe type, FSMManager owner) { return(CreateAction(type, owner.Agent, owner)); }