Пример #1
0
 public void Damage(float amount)
 {
     health -= amount;
     if (health <= 0)
     {
         ded = true;
         DeathSource.Play();
         StartCoroutine(DeathDelay());
     }
 }
Пример #2
0
    public void Play(DeathSource killer, Quaternion rotation)
    {
        sprite.transform.rotation = rotation;

        GetComponent <Animator>().SetTrigger(killer.ToString());

        glubSound.Play();
        if (killer == DeathSource.Lava)
        {
            frySound.Play();
        }
    }
Пример #3
0
    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);
    }
Пример #4
0
    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());
    }