/// <summary> /// Add the current score to the leaderboard /// </summary> private void AddCurrentScoreToLeaderboard() { float currentScore = ScoreKeeper.CurrentScore; string playerName = GameOptionsManager.GetCurrentGameOptions().playerName; ScoreLocalLeaderboards.AddScore(playerName, currentScore, SceneManager.GetActiveScene().name); }
/// <summary> /// Update the volume of this audio source to the user selected /// SFX volume /// </summary> private void UpdateAudioSourceVolume() { //Set the audio soruce volume to the set SFX volume if (playSource) { playSource.volume = GameOptionsManager.GetCurrentGameOptions().sfxVolume; } }
/// <summary> /// Load the existing game options in to options fields /// </summary> private void LoadOptionsInToUI() { //Load Options from Manager GameOptionsInfo loadedOptions = GameOptionsManager.GetCurrentGameOptions(); //Load values in to ui elements musicVolumeSlider.value = loadedOptions.musicVolume; sfxVolumeSlider.value = loadedOptions.sfxVolume; }
/// <summary> /// Update the music volume of future and currently /// playing tracks. /// Called by event when options are updated /// </summary> private void UpdateMusicVolume() { float newVolume = GameOptionsManager.GetCurrentGameOptions().musicVolume; //Set active player volume if (musicPlayers[activeMusicPlayerIndex]) { musicPlayers[activeMusicPlayerIndex].volume = newVolume; } //Set target volume for when we are fading in songs targetMusicVolume = newVolume; }
/// <summary> /// Sets the phones gyro offset. Used for calibration /// of the device so we detect up as the same /// as the players phone /// </summary> public static void SetDeviceGyroOffset() { phoneRotationOffset = GyroToUnity(Quaternion.Euler(GameOptionsManager.GetCurrentGameOptions().phoneRotOffset)); Debug.Log("Set Phone Rotation:" + phoneRotationOffset.eulerAngles); }