Ejemplo n.º 1
0
    // override the damage function in Health
    public override void Damage(int damageAmount)
    {
        base.Damage(damageAmount);

        // decrement damage from the current health
        currDemonHealth.value -= damageAmount;

        // demon hit
        demonHit.Raise();

        // update the hearts
        updateHearts.Raise();

        if (currHealth > 0)
        {
            if (flash)
            {
                flash.Flash();
            }
        }
        else if (currHealth == 0)
        {
            isDemonDead = !isDemonDead;

            StartCoroutine(DemonDeathCoroutine());

            demonState.ChangeState(GeneralState.dead);

            hurtboxCollider.enabled = false;
        }
    }
Ejemplo n.º 2
0
    public override void OnDamage()
    {
        base.OnDamage();

        if (flasher)
        {
            flasher.Flash();
        }
    }
Ejemplo n.º 3
0
 public override void OnProjectileHit(Projectile p)
 {
     Destroy(p.gameObject);
     curHP -= 1;
     if (curHP <= 0)
     {
         Kill();
     }
     else
     {
         damageFX.Flash();
     }
 }
Ejemplo n.º 4
0
    public void TakeDamage(float amt)
    {
        health -= amt;
        DamageFlash.Flash();
        AudioSource.PlayClipAtPoint(hurtClip, transform.position);

        if (health <= 0)
        {
            // TODO: Death animation?

            PlayerPrefs.SetInt("Victory", 0);
            Application.LoadLevel("gameOver");
        }
    }
Ejemplo n.º 5
0
 public void OnProjectileHit(Projectile p)
 {
     Destroy(p.gameObject);
     hp -= 1;
     if (hp <= 0)
     {
         GameObject go = Instantiate(deathFXPrefab) as GameObject;
         go.transform.position = transform.position;
         Destroy(gameObject);
     }
     else
     {
         damageFX.Flash();
     }
 }