public void Die() { Destroy(gameObject); Destroy(Instantiate(deathEffect, new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, -5), Quaternion.identity), 2); ScreamSound s = (ScreamSound)yay.GetComponent <ScreamSound>(); s.Scream(); }
public void DamagePlayer(int damage) { ScreamSound s = (ScreamSound)ouch.GetComponent <ScreamSound>(); s.Scream(); playerStats.Health -= damage; if (playerStats.Health <= 0) { GameMaster.KillPlayer(this); } }
IEnumerator GameOverSequence() { yield return(new WaitForSeconds(waitTimeOne)); ScreamSound audio = FindObjectOfType <ScreamSound>(); if (!audio.GetComponent <AudioSource>().isPlaying) { audio.GetComponent <AudioSource>().Play(); } yield return(new WaitForSeconds(waitTimeTwo)); SceneManager.LoadScene("Game Over"); }