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