예제 #1
0
    void Update()
    {
        RaycastHit hit;

        if (!visionController.CanSeePlayer(out hit, true))
        {
            enemyStateMachine.ActivateState(enemyPatrolState);
            return;
        }
        else if (visionController.CanSeePlayer(out hit, true))
        {
            navMeshController.StopNavMeshAgent();
            Debug.Log("Shoot");
        }
        navMeshController.UpdateTargetPosition();
    }
예제 #2
0
    void Update()
    {
        RaycastHit hit;

        if (visionController.CanSeePlayer(out hit))
        {
            navMeshController.player = hit.transform;
            enemyStateMachine.ActivateState(enemyActionState);
            return;
        }

        if (navMeshController.ArrivedToTargetPosition())
        {
            nextWayPoint = (nextWayPoint + 1) % WayPoints.Length;
            UpdateTargetWayPoint();
        }
    }