private bool IsBloodyAttack(XBoxComponent cruel, XBoxComponent hard) { XBoxRect attackBox = cruel.GetAttackBoxRect(); List <XBoxRect> receiveBoxes = hard.GetReceiveDamageBoxesRect(); if (attackBox == null || receiveBoxes == null) { return(false); } XBoxRect box = new XBoxRect(); for (int i = 0; i < receiveBoxes.Count; i++) { XBoxRect lapBox = XBoxRect.Overlap(attackBox, receiveBoxes[i]); if (lapBox.Width >= 0) { if (box.Height < lapBox.Height) { box.Copy(lapBox); } } } if (box.Width >= 0) { AddBloodyHeroes(cruel, hard, box); return(true); } return(false); }
private void AddBloodyFlexiableBoxes(XBoxComponent attack) { XBoxRect attackBox = attack.GetAttackBoxRect(); if (attackBox == null || _flexibleHurtBoxes.Count < 1) { return; } for (int i = 0; i < _flexibleHurtBoxes.Count; i++) { XBoxRect box = XBoxRect.Overlap(attackBox, _flexibleHurtBoxes[i].GetFlexibleHurtBox()); if (box.Width >= 0) { AddBloodyHeroes(attack, _flexibleHurtBoxes[i].GetActiveId(), box); } } }
private bool AttackOnBullet(XBoxComponent hero) { XBoxRect attackBox = hero.GetAttackBoxRect(); if (attackBox == null) { return(false); } if (_bullets.Count > 0) { for (int i = 0; i < _bullets.Count; i++) { XBoxRect lapBox = XBoxRect.Overlap(attackBox, _bullets[i].GetBulletHitBox()); if (lapBox.Width >= 0) { AddBloodyHeroes(hero, _bullets[i].gid, lapBox); return(true); } } } return(false); }