void Awake() { GameObject go = GameObject.Find("SoundManager"); backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic)); tone = other.getTone(); }
void Start() { GameObject go = GameObject.Find("SoundManager"); backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic)); highscore = other.highscore; }
public void Dead() { GameObject go = GameObject.Find("SoundManager"); backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic)); bool tone = other.getTone(); if (tone == true) { source.PlayOneShot(die); } }
// Awake is called when backgroundMusic is created private void Awake() { if (instance != null && instance != this) { Destroy(this.gameObject); return; } else { instance = this; } DontDestroyOnLoad(this.gameObject); }
void Awake() { if (instance != null && instance != this) { return; } else { instance = this; } //Keep the song playing DontDestroyOnLoad(this.gameObject); }
public void BirdDied() { if (score > highscore) { GameObject go = GameObject.Find("SoundManager"); backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic)); highscore = score; other.setScore(score); } HighText.text = "High Score : " + highscore.ToString(); SkorText.text = "Score : " + score.ToString(); GameOverCanvas.SetActive(true); gameOver = true; }
void Update() { GameObject go = GameObject.Find("SoundManager"); backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic)); Image image = toggle.targetGraphic as Image; if (toggle.isOn) { other.setTone(true); image.overrideSprite = bg1; } else { other.setTone(false); image.overrideSprite = bg2; } }
void Sound() { GameObject go = GameObject.Find("SoundManager"); backgroundMusic other = (backgroundMusic)go.GetComponent(typeof(backgroundMusic)); Image image = toggle.targetGraphic as Image; if (toggle.isOn) { other.setActive(true); image.overrideSprite = bg1; other.StartAudio(); } else { other.setActive(false); image.overrideSprite = bg2; other.PauseAudio(); } }
public void ChangeSong(int number) { music = GameObject.FindWithTag("Music").GetComponent <backgroundMusic>(); music.SetChoice(number); }