// Update is called once per frame void Update() { if (currentState == GameState.Running) { GameTimer += Time.deltaTime; } float percentDone = GameTimer / GameLength; float nbOfMinutesElapsed = Mathf.Lerp(0, 360, percentDone); int minutes = Mathf.FloorToInt(Mathf.Repeat(nbOfMinutesElapsed, 60)); int hours = (int)Mathf.Repeat(Mathf.FloorToInt(nbOfMinutesElapsed / 60) + 21, 24); //music if (percentDone > 0.5f && currentState == GameState.Running && sceneAudio.currentlyPlaying == SceneAudioManager.Track.Start) { sceneAudio.PlayMiddleNight(); } clock.text = $"{hours:00}" + ":" + $"{minutes:00}"; GuestSpawner spawner = GameObject.Find("Master").GetComponent <GuestSpawner>(); spawner.TargetQuantity = (int)Mathf.Lerp(10, 50, percentDone); if (complaintManager.TotalValue() >= ComplaintsTillGameOver && currentState == GameState.Running) { currentState = GameState.BadEnding; CallPolice(); } else if (percentDone >= 1 && currentState == GameState.Running) { currentState = GameState.GoodEnding; sceneAudio.PlayGoodTrack(); ShowGoodEnding(); } }
/// <summary> /// Set some variable references that the guest needs at the beginning of spawning. /// This method is called by the spawner. /// </summary> /// <param name="navigator">Reference to the navigator script.</param> /// <param name="exit">NavigationInteraction where the guest should exit.</param> /// <param name="guestSpawner">Reference to the spawner of the guests.</param> public void InitializedGuest(Navigator navigator, NavigationInteraction exit, GuestSpawner guestSpawner) { this.navigator = navigator; this.exit = exit; this.guestSpawner = guestSpawner; }