public virtual void takeDamage(float damage, BaseAttack.Element type)
    {
        dmgColor = yellowColor;
        if (type == weakness)
        {
            damage  *= weakMult;
            dmgColor = redColor;
        }
        else if (type == resistance)
        {
            damage  /= weakMult;
            dmgColor = blackColor;
        }
        if (accumulatedDamage < 0)
        {
            accumulatedDamage = 0;
        }
        accumulatedDamage += damage;

        if (!enemyController) // not moveable ignore, non moveable enemy will handle
        {
            return;
        }

        if (currentHealth <= 0f)
        {
            enemyController.handleEnemyDeath();
        }
    }
 /*
  * Collisions are damage stacking with fire rings so this is a work around. use handleAttack otherwise
  */
 public virtual void HandleMercyAttack(float damage, BaseAttack.Element element)
 {
     if (mercyTimer > 0)
     {
         return;
     }
     mercyTimer = MercyTime;
     enemyHealth.takeDamage(damage, element);
 }
Beispiel #3
0
 private void updateBossHealth(float damage, BaseAttack.Element element)
 {
     if (isDead && !isReviving)
     {
         SetHealth(bossHealth - base.enemyHealth.calculateDamageTaken(damage, element));
         if (bossHealth <= 0)
         {
             handleFinishBossFight();
         }
     }
 }
 public float calculateDamageTaken(float damage, BaseAttack.Element type)
 {
     if (type == weakness)
     {
         damage *= weakMult;
     }
     else if (type == resistance)
     {
         damage /= weakMult;
     }
     return(damage);
 }
 public override void handleAttack(float damage, BaseAttack.Element type)
 {
     if (type == this.type)
     {
         base.enemyHealth.takeDamage(damage, type);
         animator.SetTrigger("hit");
         if (!hitAudio.isPlaying)
         {
             hitAudio.Play();
         }
     }
     else
     {
         base.enemyHealth.takeDamage(0, type);
     }
 }
Beispiel #6
0
 public override void handleAttack(float damage, BaseAttack.Element element)
 {
     isSeeking     = false;
     rb2d.velocity = new Vector2(0f, 0f);
     an.SetBool("isExplode", true);
 }
Beispiel #7
0
 public override void handleAttack(float damage, BaseAttack.Element element)
 {
     setPermanentlyAngry();
     base.handleAttack(damage, element);
 }
Beispiel #8
0
 override public void handleAttack(float damage, BaseAttack.Element element)
 {
     base.handleAttack(damage, element);
     updateBossHealth(damage, element);
     isJumpAttack = false;
 }
 public override void handleAttack(float damage, BaseAttack.Element element)
 {
     base.handleAttack(damage, element);
     SetHealth(enemyHealth.currentHealth);
 }
 public override void handleAttack(float damage, BaseAttack.Element element)
 {
     SetHealth(enemyHealth.currentHealth - enemyHealth.calculateDamageTaken(damage, element));
     enemyHealth.takeDamage(damage, element);
 }
 virtual public void handleAttack(float damage, BaseAttack.Element element)
 {
     enemyHealth.takeDamage(damage, element);
 }