public void CollidedWith(Collider2D collider) { Hurtbox hurtbox = collider.GetComponent <Hurtbox>(); if (hurtbox) { if ((hurtbox.parentResponder.GetType() == typeof(Character))) { if ((Character)hurtbox.parentResponder == parentChar)//do not hit yourself { return; } } foreach (IGotHitResponder o in ObjectsHit) { if (o == hurtbox.parentResponder)//can not hit the same object multiple times with the same hitbox { return; } } hurtbox.GotHit(this); ObjectsHit.Add(hurtbox.parentResponder); parentChar.charState.OnDealDamage(hitboxData.damage); StartCoroutine(ApplyHitlag(FormulaHelper.GetFramesOfHitLag(hitboxData))); } }