Ejemplo n.º 1
0
    public void TryToChaseTarget()
    {
        if (enemyMaster.myTarget != null && myNavMeshAgent != null && !enemyMaster.isNavPaused)
        {
            myNavMeshAgent.SetDestination(enemyMaster.myTarget.position);

            if (myNavMeshAgent.remainingDistance > myNavMeshAgent.stoppingDistance)
            {
                enemyMaster.CallEventEnemyWalking();
                enemyMaster.CallEventFollowingPlayer();
                enemyMaster.isOnRoute = true;

                Debug.Log("Disabling patrol.");
                myWanderAI.isWandering    = false;
                patrollingAI.isPatrolling = false;
            }
        }
    }