Esempio n. 1
0
 public FSMBaseAction(E_ActionTYpe type, Agent agent, FSMManager owner)
 {
     _actionType = type;
     _agent      = agent;
     _owner      = owner;
     Initialize();
 }
Esempio n. 2
0
 public FSMManager(Agent agent, E_ActionTYpe defaultAction)
 {
     _agent         = agent;
     _defaultAction = defaultAction;
     _isStop        = false;
     _isTransform   = true;
 }
Esempio n. 3
0
    /// <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);
        }
    }
Esempio n. 4
0
    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);
        }
    }
Esempio n. 5
0
 public static FSMBaseAction Create(E_ActionTYpe type, FSMManager owner)
 {
     return(CreateAction(type, owner.Agent, owner));
 }