private void switchPauseOption(PauseMenuButton next) { currentOptionButton.BroadcastMessage("SelectedChanged", false, SendMessageOptions.RequireReceiver); next.BroadcastMessage("SelectedChanged", true, SendMessageOptions.RequireReceiver); currentOptionButton = next; /* * Count frames (calls to update) in future, because Time.timeScale is zero, and we need button selection cooldown. */ nextButtonSelectionFrame = frame + (int)(buttonSelectionCooldownTime * fps); }
private void pauseGame() { paused = true; nextButtonSelectionFrame = frame + (int)(buttonSelectionCooldownTime * fps); masterVolumeObject.BroadcastMessage("SetMaster", pauseMenuSoundMultiplier, SendMessageOptions.RequireReceiver); graphics.SetActive(true); Time.timeScale = 0; /* * Select the default first button, and deselect the rest. */ currentOptionButton = firstButton; currentOptionButton.BroadcastMessage("SelectedChanged", true, SendMessageOptions.RequireReceiver); foreach(var button in pauseOptions.Where(g => g != firstButton)) { button.BroadcastMessage("SelectedChanged", false, SendMessageOptions.RequireReceiver); } }