Exemplo n.º 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));
    }
Exemplo n.º 2
0
 public void HideButtons()
 {
     OnPlayButtonClick.Invoke();
     gameObject.SetActive(false);
 }
Exemplo n.º 3
0
 public void PlayButtonClick() => OnPlayButtonClick?.Invoke();