public void Damage(float amount) { health -= amount; if (health <= 0) { ded = true; DeathSource.Play(); StartCoroutine(DeathDelay()); } }
public void Play(DeathSource killer, Quaternion rotation) { sprite.transform.rotation = rotation; GetComponent <Animator>().SetTrigger(killer.ToString()); glubSound.Play(); if (killer == DeathSource.Lava) { frySound.Play(); } }
public void Die(bool playFrying = false) { DeathSource killer = (playFrying) ? DeathSource.Lava : DeathSource.Icicle; HeroDead dfx = Instantiate(deathFX, transform.position, Quaternion.identity) .GetComponent <HeroDead>(); dfx.Play(killer, transform.rotation); endState.FailLevel(); Destroy(gameObject); }
public void Die(DeathSource source) { AudioClip deathSound = null; switch (source) { case DeathSource.Fall: deathSound = sounds.fallDeath; break; case DeathSource.Bullet: deathSound = sounds.bulletDeath; break; } audio.PlayOneShot(deathSound); StartCoroutine(WaitForDeath()); }