/// <summary> /// Deal damage to a hit hurtbox. Do not call this method outside of <see cref="Hit(Collider2D)"/> /// </summary> /// <param name="hurtbox"></param> protected void ApplyAttackDamageTo(Collider2D hurtbox, Hurtbox.State hurtState) { // Initialize var hp = hurtbox.GetComponent <Hurtbox>().hp; Attacks[currentAttackIndex].Sign = Math.Sign(transform.localScale.x); // melee cannot trigger superstun, so we will never need to call DealDamageCritical if (hurtState == Hurtbox.State.Armored) { hp.DealDamageArmored(Attacks[currentAttackIndex]); } else { hp.DealDamageNormal(Attacks[currentAttackIndex]); } //hurtbox.GetComponent<Hurtbox>().Health.LogHp(); Hitbox.SetInactive(); }
/// <summary> /// Deal damage to a hit hurtbox. Do not call this method outside of <see cref="Hit(Collider2D)"/> /// </summary> /// <param name="hurtbox"></param> /// <param name="hurtState"></param> protected void ApplyAttackDamageTo(Collider2D hurtbox, Hurtbox.State hurtState) { // Initialize var hp = hurtbox.GetComponent <Hurtbox>().hp; attackData.Sign = xSign; // Deal Damage if (hurtState == Hurtbox.State.Critical) { hp.DealDamageCritical(attackData); } else if (hurtState == Hurtbox.State.Armored) { hp.DealDamageArmored(attackData); } else { hp.DealDamageNormal(attackData); } // Destroy self on impact Destroy(gameObject); }