public void Update() { float distanceFromPlayer = Vector3.Distance(gameObject.transform.position, myPlayer.transform.position); if (distanceFromPlayer <= minDistanceFromPlayerToExitScene && Input.GetAxis("ActiveObject") != 0.0f) { if ((GameplayState.AllHostagesHasBeenRescued() && mustRescueAllHostagesToExitScene == true) || (mustRescueAllHostagesToExitScene == false)) { GameplayState.CurrentState = GameplayState.StateType.WIN; GameResult(); } } }