// Update is called once per frame void Update() { // Comprueba si ve al jugador RaycastHit hit; if (visionController.canSeePlayer(out hit)) { navMeshController.pursuitEnemy = hit.transform; stateMachine.ActivateState(stateMachine.PursuitState); return; } if (navMeshController.Arrive()) { nextWayPoint = (nextWayPoint + 1) % WayPoints.Length; UpdateDestinyWayPoint(); } }
// Update is called once per frame void Update() { RaycastHit hit; if (visionController.canSeePlayer(out hit)) { navMeshController.pursuitEnemy = hit.transform; stateMachine.ActivateState(stateMachine.PursuitState); return; } transform.Rotate(0f, searchRotationVelocity * Time.deltaTime, 0f); searchingTime += Time.deltaTime; if (searchingTime > searchTime) { stateMachine.ActivateState(stateMachine.PatrolState); return; } }
// Update is called once per frame void Update() { RaycastHit hit; if (!visionController.canSeePlayer(out hit, true)) { stateMachine.ActivateState(stateMachine.AlertState); return; } navMeshController.UpdateDestinyPointNavMeshAgent(); }