/// <summary> /// Occurs when the ok button is clicked. /// </summary> /// <param name="eventData">Pointer click event data.</param> public void OnPointerClick(PointerEventData eventData) { SpeedManager.instance.SetToNormalSpeed(); // Check if the game has reached its endpoint. if (ProgressManager.CheckGameEnd()) { PlayerPrefs.SetInt("EndingCompleted", 0); SceneManager.LoadScene("GoodEndingScene"); } else { int unlockedCustomerNumber; // Check if a customer is unlocked. if (ProgressManager.CheckCustomerUnlock(out unlockedCustomerNumber)) { UnlockCustomerInformation.CustomerNumber = unlockedCustomerNumber; SceneManager.LoadScene("UnlockedCustomerScene"); } else { // Just load normally if no customer is unlocked. ProfitTracker.instance.Reset(); //Advertisement.Show(); SceneManager.LoadScene("PreparationScene"); } } }
/// <summary> /// Called every deltatime. /// </summary> void FixedUpdate() { // Check if the deltatime has elapsed equal to the amount of delta time per clock minute. if (deltaTimeElapsed % DeltaTimePerMinuteIncrement == 0) { CurrentMinute += MinuteIncrement; if (CurrentMinute == MinutesPerHour) { CurrentMinute = 0; CurrentHour++; } // Inform the listeners that the clock has been updated. if (ClockUpdated != null) { ClockUpdated(this, new EventArgs()); } } // End the simulation when the end hour and minute has been reached. if (CurrentHour >= EndingHour && CurrentMinute >= EndingMinute) { SpeedManager.instance.Pause(); if (!DayIncremented) { ProgressManager.Day++; DayIncremented = true; // Unlock a customer if possible. int unlockedCustomerNumber; ProgressManager.CheckCustomerUnlock(out unlockedCustomerNumber); } ProgressManager.SaveProgressToFile(); // Display the end day panel. EndDay.SetActive(true); // Hide the speed button. SpeedButton.SetActive(false); } deltaTimeElapsed++; }