Esempio n. 1
0
    public override void Reason(GameObject player, AgentHandler agent)
    {
        Vector3 directionToPlayer = GameConstants.Instance.PlayerObject.transform.position - agent.transform.position;

        if (Physics.Raycast(agent.transform.position, directionToPlayer.normalized, directionToPlayer.magnitude, LayerMask.GetMask("Default")))
        {
            agent.FSMTransitionPassthrough(fsmTransition.ToLostPlayer);
        }
        else
        {
            EditableTree SwitchToAttackDecisionTree = agent.GetSwitchToAttackDecisionTree();

            if (SwitchToAttackDecisionTree != null)
            {
                SwitchToAttackDecisionTree.mRoot.MakeDecision(agent);
            }

            //if (directionToPlayer.magnitude <= agent.GetAttackRange())
            //agent.FSMTransitionPassthrough(fsmTransition.ToAttack);
        }
    }