// Update is called once per frame void Update() { RaycastHit hit; if (visionControl.SeePlayer(out hit)) { controladorNavMesh.followObjective = hit.transform; statesMachine.ActiveState(statesMachine.PatrolState); return; } if (controladorNavMesh.IArrived()) { nextWayPoint = (nextWayPoint + 1) % WayPoints.Length; UpdateWayPointDestiny(); } }