//Depending on dropdown box, one of these sounds will be played public void PlayDeathSound(DeathSound play) { switch (play) { case DeathSound.wihelmScream: this.WihelmScream(); break; case DeathSound.manDeath1: this.ManDeath1(); break; case DeathSound.bearDeath1: this.BearDeath1(); break; case DeathSound.slimeDeath1: this.SlimeDeath1(); break; case DeathSound.breath: this.Breath(); break; default: this.WihelmScream(); break; } }
void OnCollisionEnter2D(Collision2D hit) { if (hit.gameObject.tag == "Killer") { theGameManager.RestartGame(); playerSpeed = playerSpeedStore; speedMilestoneCount = speedMilestoneCountStore; speedIncreaseMilestone = speedIncreaseMilestoneStore; DeathSound.Play(); } }
// Start is called when a script is enabled. If you need to make sure something is initialized // put it in awake. // void Start() { footsound = GameObject.Find("Billie").GetComponent <AudioSource> (); envtsounds = GameObject.Find("Environmental Sound"); deathSound = GameObject.Find("DeathSound").GetComponent <DeathSound> (); cursor = GameObject.Find("Main Camera").GetComponent <HandleCursor> (); Time.timeScale = 1; gameoverObjects = GameObject.FindGameObjectsWithTag("ShowOnGameOver"); menuObjects = GameObject.FindGameObjectsWithTag("MenuButton"); hidegameover(); }
protected void onDeath(EventArgs args) { EventHandler handler = DeathEvent; if (handler != null) { handler(this, args); } if (DeathSound != null) { DeathSound.Play(); } ActiveAnimation = DeathAnimation; }
/// <summary> /// Plays death sound. /// </summary> protected void PlayDeathSound() { DeathSound?.PlayIfStopped(); }