Ejemplo n.º 1
0
 void CheckForNewHighscore()
 {
     if (currentTime > PlayerPrefsConstants.GetHighscoreTime())
     {
         PlayerPrefsConstants.SetHighscoreTime(currentTime);
     }
 }
Ejemplo n.º 2
0
    void OnSubmitHighscore()
    {
        string name = nameInput.text.Trim();

        if (name.Length < 3)
        {
            return;
        }

        int score = scoreManager.GetHighscoreTimeInSeconds();

        PlayerPrefsConstants.SetHighscorePlayerName(name);

        StartCoroutine(TryPostHighscore(name, score));
    }
Ejemplo n.º 3
0
    void SaveSettings()
    {
        float sfxVal       = sfxSlider.value / 100;
        float musicVal     = musicSlider.value / 100;
        float announcerVal = announcerSlider.value / 100;

        PlayerPrefsConstants.SetSFXVolume(sfxVal);
        PlayerPrefsConstants.SetMusicVolume(musicVal);
        PlayerPrefsConstants.SetAnnouncerVolume(announcerVal);

        if (FindObjectOfType <SoundSource>())
        {
            SoundSource[] allSoundSources = FindObjectsOfType <SoundSource>();
            foreach (SoundSource s in allSoundSources)
            {
                s.SetupSound();
            }
        }
    }
Ejemplo n.º 4
0
    public void SetupSound()
    {
        float currentVol = originVol;

        if (soundType == SoundType.SFX)
        {
            float pref = PlayerPrefsConstants.GetSFXVolume();
            audioSource.volume = currentVol / 100 * (pref * 100);
        }
        else if (soundType == SoundType.Music)
        {
            float pref = PlayerPrefsConstants.GetMusicVolume();
            audioSource.volume = currentVol / 100 * (pref * 100);
        }
        else if (soundType == SoundType.Announcer)
        {
            float pref = PlayerPrefsConstants.GetAnnouncerVolume();
            audioSource.volume = currentVol / 100 * (pref * 100);
        }
    }
Ejemplo n.º 5
0
    public void ShowGameOverPanel()
    {
        musicAudioSource.clip = gameOverTheme;
        musicAudioSource.Play();
        scoreManager.GameOver();
        if (scoreManager.GetScoreString() == scoreManager.GetHighscoreString())
        {
            gameOverTimeText.SetText(string.Format(LocalizationManager.instance.GetLocalizedValue("gameover_new_highscore"), scoreManager.GetHighscoreString()));
            gameOverHighscoreText.gameObject.SetActive(false);
            nameInputPanel.gameObject.SetActive(true);
            nameInput.onValueChanged.AddListener(OnHighscoreNameInputChange);

            if (PlayerPrefsConstants.GetHighscorePlayerName() != string.Empty &&
                PlayerPrefsConstants.GetHighscorePlayerName().Length >= 3)
            {
                nameInput.text = PlayerPrefsConstants.GetHighscorePlayerName();
                submitHighscoreButton.interactable = true;
            }
            submitHighscoreButton.onClick.AddListener(OnSubmitHighscore);
        }
        else
        {
            nameInputPanel.gameObject.SetActive(false);
            gameOverHighscoreText.gameObject.SetActive(true);

            gameOverTimeText.SetText(string.Format(
                                         LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("gameover_score") : "Du hast {0} durchgehalten!",
                                         scoreManager.GetScoreString()
                                         ));
            gameOverHighscoreText.SetText(string.Format(
                                              LocalizationManager.instance != null ? LocalizationManager.instance.GetLocalizedValue("gameover_highscore_score") : "Dein Highscore: {0}",
                                              scoreManager.GetHighscoreString()
                                              ));
        }

        gameOverPanelAnimator.SetBool("isActive", true);
    }
Ejemplo n.º 6
0
 void SetupSettings()
 {
     sfxSlider.value       = PlayerPrefsConstants.GetSFXVolume() * 100;
     musicSlider.value     = PlayerPrefsConstants.GetMusicVolume() * 100;
     announcerSlider.value = PlayerPrefsConstants.GetAnnouncerVolume() * 100;
 }
Ejemplo n.º 7
0
 public int GetHighscoreTimeInSeconds()
 {
     return(Mathf.RoundToInt(PlayerPrefsConstants.GetHighscoreTime()));
 }
Ejemplo n.º 8
0
 public string GetHighscoreString()
 {
     return(PlayerPrefsConstants.GetHighscoreTimeString());
 }