protected override AgentAction MakeAgentAction()
    {
        AgentActionCombatMove agentAction = AgentActionFactory.Get(AgentActionType.COMBAT_MOVE, Owner) as AgentActionCombatMove;

        agentAction.moveType            = UnityEngine.Random.Range(0, 2) == 0 ? MoveType.LEFTWARD : MoveType.RIGHTWARD;
        agentAction.target              = Owner.BlackBoard.desiredTarget;
        agentAction.totalMoveDistance   = UnityEngine.Random.Range(2.0f, 4.0f);
        agentAction.minDistanceToTarget = Owner.BlackBoard.DistanceToTarget * 0.7f;
        return(agentAction);
    }
Exemple #2
0
    protected override void Initialize(AgentAction action)
    {
        base.Initialize(action);
        _agentActionCombatMove = Owner.BlackBoard.curAction as AgentActionCombatMove;

        UpdateFinalRotation();

        Owner.BlackBoard.motionType = MotionType.WALK;
        _rotationProgress           = 0;
        _movedDistance            = 0;
        Owner.BlackBoard.moveType = MoveType.NONE;
        UpdateMoveType();

        if (Owner.isPlayer == false && Owner.BlackBoard.moveType == MoveType.BACKWARD)
        {
            Owner.BlackBoard.Fear = 0;
        }
    }
Exemple #3
0
    protected override AgentAction MakeAgentAction()
    {
        AgentActionCombatMove agentAction = AgentActionFactory.Get(AgentActionType.COMBAT_MOVE, Owner) as AgentActionCombatMove;

        agentAction.moveType            = MoveType.BACKWARD;
        agentAction.target              = Owner.BlackBoard.desiredTarget;
        agentAction.minDistanceToTarget = 0;
        if (Owner.agentType == AgentType.DOUBLE_SWORDS_MAN) // 这里暂时偷个懒,另外扩展一个不同参数的goapaction才是更灵活的做法
        {
            agentAction.motionType        = MotionType.RUN;
            agentAction.totalMoveDistance = UnityEngine.Random.Range(4f, 6f);
        }
        else
        {
            agentAction.totalMoveDistance = UnityEngine.Random.Range(2f, 5f);
        }

        return(agentAction);
    }