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(); }
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(); } }