private void CheckForHitboxOverlap(EHHitboxActorComponent DComponent1, EHHitboxActorComponent DComponent2) { foreach (EHHitbox Hitbox1 in HitboxDictionary[DComponent1]) { foreach (EHHitbox Hitbox2 in HitboxDictionary[DComponent2]) { if (Hitbox1.gameObject.activeInHierarchy && Hitbox2.gameObject.activeInHierarchy) { Hitbox1.CheckForHitboxOverlap(Hitbox2); } } } }
/// <summary> /// Helper method to check that we are overlapping with the two passed in hitbox /// </summary> /// <param name="HitboxSet1"></param> /// <param name="HitboxSet2"></param> /// <returns></returns> private void CheckForOverlapInHitboxSetsAndLaunchAppropriateEvent(HashSet <Hitbox> HitboxSet1, HashSet <Hitbox> HitboxSet2) { foreach (Hitbox Hitbox1 in HitboxSet1) { foreach (Hitbox Hitbox2 in HitboxSet2) { if (Hitbox1.IsOverlappingHitboxAndValid(Hitbox2)) { if (!Hitbox1.IsHitboxCurrentlyRegisteredAsOverlapped(Hitbox2)) { Hitbox1.OnHitboxBeginOverlap(Hitbox2); Hitbox2.OnHitboxBeginOverlap(Hitbox1); } Hitbox1.OnHitboxOverlapStay(Hitbox2); Hitbox2.OnHitboxOverlapStay(Hitbox1); } else if (Hitbox1.IsHitboxCurrentlyRegisteredAsOverlapped(Hitbox2)) { Hitbox1.OnHitboxEndOverlap(Hitbox2); Hitbox2.OnHitboxEndOverlap(Hitbox1); } } } }