예제 #1
0
    private void Awake()
    {
        _audioService = GameObject.FindWithTag("Audio Service").GetComponent <IAudioService>();

        playButton.onClick.AddListener(() =>
        {
            OnPlayButtonClick?.Invoke();
            _audioService.Play(playButton.GetComponent <SoundSource>().soundType);
        });
        shopButton.onClick.AddListener(() =>
        {
            OnSettingsButtonClick?.Invoke();
            _audioService.Play(shopButton.GetComponent <SoundSource>().soundType);
        });
        quitButton.onClick.AddListener(() =>
        {
            OnQuitButtonClick?.Invoke();
            _audioService.Play(quitButton.GetComponent <SoundSource>().soundType);
        });
        musicToggle.onValueChanged.AddListener(value => _audioService.ToggleMusic(value));
        soundsToggle.onValueChanged.AddListener(value => _audioService.ToggleSounds(value));
    }
예제 #2
0
 private void settingsButton_Click(object sender, EventArgs e)
 {
     OnSettingsButtonClick?.Invoke();
 }