Ejemplo n.º 1
0
    private void InitMusic()
    {
        audioSource = GetComponent <AudioSource>();
        var music = GamerPrefs.GetMusicOn(); // 悪い

        willPlay = (music == 1) ? true : false;
    }
Ejemplo n.º 2
0
    public void HandleSound()
    {
        if (optionsPanelVisible)
        {
            optionsPanelVisible = false;
            optionsPanel.SetActive(false);
        }
        int music = GamerPrefs.GetMusicOn();

        if (music == 1)
        {
            music = 0;
            GamerPrefs.SetMusicOn(0);
        }
        else
        {
            music = 1;
            GamerPrefs.SetMusicOn(1);
        }
        Text soundText = soundButton.GetComponent <Text>();

        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBgMusic();
    }
Ejemplo n.º 3
0
    private void HandleMusicButtonText()
    {
        var music = GamerPrefs.GetMusicOn();

        soundText      = soundButton.GetComponent <Text>();
        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBgMusic();
    }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        speed       = -1 * Mathf.Sqrt(speed * speed); // using square root incase speed is negative
        audioSource = GetComponent <AudioSource>();
        int music = GamerPrefs.GetMusicOn();          // 悪い

        willPlay = (music == 1) ? true : false;
        dangos   = -1;
        InitShieldFunc();
    }
    private void HandleMusicButtonText()
    {
        // 音楽
        int music = GamerPrefs.GetMusicOn();         // 悪い

        soundText      = GameObject.Find("Sound Button").GetComponent <Text>();
        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBGMusic();
    }
    // UI Update /////////////////////////////////

    // Game Play /////////////////////////////////

    public void HandleGlassSound()
    {
        if (GamerPrefs.GetMusicOn() == 1)
        {
            willPlayMusic = true;
        }
        else
        {
            willPlayMusic = false;
        }
    }
Ejemplo n.º 7
0
    public void PlayBackgroundMusic(AudioClip clip)
    {
        var willPlay = GamerPrefs.GetMusicOn() == 1 ? true : false;

        if (!willPlay || bgAudioSource.isPlaying)
        {
            return;
        }
        bgAudioSource.clip = clip;
        bgAudioSource.Play();
    }
Ejemplo n.º 8
0
    public void PlaySfx(AudioClip clip)
    {
        StopSfx();
        var willPlay = GamerPrefs.GetMusicOn() == 1 ? true : false;

        if (!willPlay)
        {
            return;
        }
        sfxAudioSource.clip = clip;
        sfxAudioSource.Play();
    }
Ejemplo n.º 9
0
    public void ForcePlayBackgroundMusic(AudioClip clip)
    {
        StopBackgroundMusic();
        var willPlay = GamerPrefs.GetMusicOn() == 1 ? true : false;

        if (!willPlay)
        {
            return;
        }
        bgAudioSource.clip = clip;
        bgAudioSource.Play();
    }
Ejemplo n.º 10
0
 public void HandleGameBGMusic()
 {
     _audioSource      = GetComponent <AudioSource>();
     _audioSource.loop = true;
     if (GamerPrefs.GetMusicOn() == 1)
     {
         willPlayMusic = true;
     }
     else
     {
         willPlayMusic = false;
     }
     HandleBGMusicStart();
 }
Ejemplo n.º 11
0
    public void HandleSound()
    {
        int music = GamerPrefs.GetMusicOn();

        if (music == 1)
        {
            music = 0;
            GamerPrefs.SetMusicOn(0);
        }
        else
        {
            music = 1;
            GamerPrefs.SetMusicOn(1);
        }
        Text soundText = GameObject.Find("Sound Button").GetComponent <Text>();

        soundText.text = (music == 1) ? "Sound On" : "Sound Off";
        willPlay       = (music == 1) ? true : false;
        HandleMainMenuBGMusic();
    }
Ejemplo n.º 12
0
    public void HandleMarketSceneBgMusic()
    {
        var music = GamerPrefs.GetMusicOn(); // 悪い

        willPlay = (music == 1) ? true : false;
        var audioSource = GetComponent <AudioSource>();

        if (willPlay)
        {
            if (!audioSource.isPlaying)
            {
                audioSource.Play();
            }
        }
        else
        {
            if (audioSource.isPlaying)
            {
                audioSource.Stop();
            }
        }
    }
Ejemplo n.º 13
0
    public void HandleHighSoreSceneBGMusic()
    {
        int music = GamerPrefs.GetMusicOn(); // 悪い

        willPlay = (music == 1) ? true : false;
        AudioSource audioSource = GetComponent <AudioSource>();

        if (willPlay)
        {
            if (!audioSource.isPlaying)
            {
                audioSource.Play();
            }
        }
        else
        {
            if (audioSource.isPlaying)
            {
                audioSource.Stop();
            }
        }
    }
Ejemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        // 音楽
        int music = GamerPrefs.GetMusicOn(); // 悪い

        willPlay = (music == 1) ? true : false;
        AudioSource audioSource = GetComponent <AudioSource>();

        if (willPlay)
        {
            if (!audioSource.isPlaying)
            {
                audioSource.Play();
            }
        }
        else
        {
            if (audioSource.isPlaying)
            {
                audioSource.Stop();
            }
        }
    }