// 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(); } }
void Update() { RaycastHit hit; if (visionControl.SeePlayer(out hit)) { controladorNavMesh.followObjective = hit.transform; statesMachine.ActiveState(statesMachine.FollowState); return; } transform.Rotate(0f, rotateFindSpeed * Time.deltaTime, 0f); timeFinding += Time.deltaTime; if (timeFinding >= durationFinding) { statesMachine.ActiveState(statesMachine.PatrolState); return; } }
void Update() { RaycastHit hit; if (!visionControl.SeePlayer(out hit, true)) { stateMachine.ActiveState(stateMachine.AlertState); return; } controladorNavMesh.ActualizarPuntoDestinoNavMeshAgent(); }