public void CollidedWith(Collider collider) { Debug.Log("Player collided with " + collider.gameObject.name); Hurtbox hurtbox = collider.GetComponent <Hurtbox>(); IHealthController hurtBoxController = hurtbox.GetComponentInParent <IHealthController>(); // the parent gameobject will implement the health and damage Damage attackDamage = new Damage(15); hurtBoxController?.ReceiveDamage(attackDamage); }
private void ProjectileHitBoss(Hurtbox _boss, Projectile _projectile) { Destroy(_projectile.gameObject); _boss.ApplyDamage(_projectile.m_damage); ScreenshakeManager.SmallShake(_projectile.m_damage); if (m_diamondEffect) { _boss.GetComponentInParent <BasicBoss>().ApplyDiamondEffectDebuff(); } }
public void collisionedWith(Collider2D collider) { Hurtbox hurtbox = collider.GetComponent <Hurtbox>(); if (hurtbox.GetComponentInParent <Hadouken>() != null) { Destroy(hurtbox.gameObject.transform.parent.gameObject); Destroy(gameObject); PlaySound("Parry"); return; } if (hurtbox.CheckIfGuarding()) { hurtbox?.getHitBy((damage / 5), 0, "parry"); } else { hurtbox?.getHitBy(damage, stunTime, "light"); } Destroy(gameObject); }