示例#1
0
    private void Awake()
    {
        soundVolume = transform.Find("soundVolume").GetComponent <TextMeshProUGUI>();

        musicVolume = transform.Find("musicVolume").GetComponent <TextMeshProUGUI>();

        transform.Find("increaseSoundBtn").GetComponent <Button>().onClick.AddListener(() => {
            // Debug.Log("increasing sound By button...!");
            soundManager.IncreaseVolume();
            UpdateRelevantText();
        });

        transform.Find("decreaseSoundBtn").GetComponent <Button>().onClick.AddListener(() => {
            soundManager.DecreaseVolume();
            UpdateRelevantText();
        });

        transform.Find("increaseMusicBtn").GetComponent <Button>().onClick.AddListener(() => {
            musicManager.IncreaseVolume();
            UpdateRelevantText();
        });

        transform.Find("decreaseMusicBtn").GetComponent <Button>().onClick.AddListener(() => {
            musicManager.DecreaseVolume();
            UpdateRelevantText();
        });

        transform.Find("backToMainMenuBtn").GetComponent <Button>().onClick.AddListener(() => {
            Time.timeScale = 1f;

            SceneLoadController.Load(SceneLoadController.Scene.MainMenuScene);
        });
    }
示例#2
0
 void Start()
 {
     if (_instance == null)
     {
         _instance = this;
     }
     if (_instance != null && _instance != this)
     {
         DestroyImmediate(gameObject);
         return;
     }
     DontDestroyOnLoad(gameObject);
 }
示例#3
0
 private void Awake()
 {
     _instance = this;
 }