Пример #1
0
 /// <summary>
 /// This method will be called upon this hitbox entering the hitbox that is passed in if they were not intersecting in the previous frame
 /// </summary>
 /// <param name="OtherHitbox"></param>
 private void HitboxBeginOverlap(EHHitbox OtherHitbox)
 {
     IntersectingHitboxSet.Add(OtherHitbox);
     OtherHitbox.IntersectingHitboxSet.Add(this);
     HitboxActorComponent.OnHitboxBeginIntersectOtherHitbox(this, OtherHitbox);
     OtherHitbox.HitboxActorComponent.OnHitboxBeginIntersectOtherHitbox(OtherHitbox, this);
 }
Пример #2
0
    /// <summary>
    /// Remove a hitbox from our manager. If the count of hitboxes has reached 0 we will remove the
    /// DamageableComponent from our list as well
    /// </summary>
    /// <param name="HitboxToRemove"></param>
    public void RemoveHitboxFromManager(EHHitbox HitboxToRemove)
    {
        if (HitboxToRemove == null || HitboxToRemove.HitboxActorComponent == null)
        {
            Debug.LogWarning("Attempted to remove an invalid hitbox from our manager. Please make sure that there is a HitboxActorComponent in the parent object of our Hitbox");
            return;
        }

        if (!HitboxDictionary.ContainsKey(HitboxToRemove.HitboxActorComponent))
        {
            Debug.LogWarning("There was no HitboxActorComponent associated with this hitbox. Perhaps you have already removed it?");
            return;
        }

        if (HitboxDictionary[HitboxToRemove.HitboxActorComponent].Remove(HitboxToRemove))
        {
            if (HitboxDictionary[HitboxToRemove.HitboxActorComponent].Count == 0)
            {
                HitboxDictionary.Remove(HitboxToRemove.HitboxActorComponent);
                AllHitboxActorComponentsList.Remove(HitboxToRemove.HitboxActorComponent);
            }
        }
        else
        {
            Debug.LogWarning("The hitbox you are trying to remove was not found in the hitbox manager. Perhaps it was already removed?");
        }
    }
Пример #3
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="OurHitbox"></param>
    /// <param name="OtherHurtbox"></param>
    private void OurHitboxIntersectOtherHurtbox(EHHitbox OurHitbox, EHHitbox OtherHurtbox)
    {
        if (OurHitbox == null || OtherHurtbox == null)
        {
            return;
        }

        if (OtherHurtbox.HitboxActorComponent.bAnimationIsInvincible)
        {
            return;//Other character was invincible when we attempted to hit them, may in the future want to add some kind of wiff affect to indicate that you made contact but couldn't hurt them
        }

        EHDamageableComponent OtherDamageableComponent = OtherHurtbox.HitboxActorComponent.DamageableComponent;

        if (OtherDamageableComponent == null)
        {
            Debug.LogWarning("There is no Damageable component associated with the hurtbox we are intersecting");
            return;
        }
        if (AttackComponent == null)
        {
            Debug.LogWarning("There is no Attack component associated with our intersecting Hitbox");
            return;
        }
        AttackComponent.OnDamageableComponentIntersectionBegin(OtherDamageableComponent);
    }
Пример #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="OurHitbox"></param>
 /// <param name="OtherHitbox"></param>
 public void OnHitboxEndintersectOtherHitbox(EHHitbox OurHitbox, EHHitbox OtherHitbox)
 {
     if (OurHitbox.GetHitboxType() == EHHitbox.EHitboxType.HITBOX)
     {
         if (OtherHitbox.GetHitboxType() == EHHitbox.EHitboxType.HURTBOX)
         {
         }
     }
 }
Пример #5
0
 /// <summary>
 /// This method should be called from an EHHitbox
 /// </summary>
 /// <param name="OurHitbox"></param>
 /// <param name="OtherHitbox"></param>
 public void OnHitboxBeginIntersectOtherHitbox(EHHitbox OurHitbox, EHHitbox OtherHitbox)
 {
     if (OurHitbox.GetHitboxType() == EHHitbox.EHitboxType.HITBOX)
     {
         if (OtherHitbox.GetHitboxType() == EHHitbox.EHitboxType.HURTBOX)
         {
             OurHitboxIntersectOtherHurtbox(OurHitbox, OtherHitbox);
         }
     }
 }
Пример #6
0
    protected override bool IsHitboxOverlapping(EHHitbox OtherHitbox)
    {
        switch (OtherHitbox.GetHitbxoShape())
        {
        case EHGeometry.ShapeType.Rect2D:
            return(RectGeometry.IsOverlappingRect(((EHHitboxRect)OtherHitbox).RectGeometry));
        }

        return(false);
    }
Пример #7
0
    /// <summary>
    /// Returns whether or not the hitbox passed in has been added to our Hitbox manager
    /// </summary>
    /// <param name="Hitbox"></param>
    /// <returns></returns>
    public bool ManagerContainsHitbox(EHHitbox Hitbox)
    {
        if (Hitbox == null || Hitbox.HitboxActorComponent == null)
        {
            return(false);
        }

        if (!HitboxDictionary.ContainsKey(Hitbox.HitboxActorComponent))
        {
            return(false);
        }

        return(HitboxDictionary[Hitbox.HitboxActorComponent].Contains(Hitbox));
    }
Пример #8
0
 /// <summary>
 /// Check if the hitbox that is passed in is currently overlapping this hitbox
 /// </summary>
 /// <param name="OtherHitbox"></param>
 /// <returns></returns>
 public bool CheckForHitboxOverlap(EHHitbox OtherHitbox)
 {
     if (IsHitboxOverlapping(OtherHitbox))
     {
         if (!IntersectingHitboxSet.Contains(OtherHitbox))
         {
             HitboxBeginOverlap(OtherHitbox);
         }
         return(true);
     }
     if (IntersectingHitboxSet.Contains(OtherHitbox))
     {
         HitboxEndOverlap(OtherHitbox);
     }
     return(false);
 }
Пример #9
0
    /// <summary>
    /// Safely adds a hitbox to our hitbox manager
    /// </summary>
    /// <param name="HitboxToAdd"></param>
    public void AddHitboxToManager(EHHitbox HitboxToAdd)
    {
        if (HitboxToAdd == null || HitboxToAdd.HitboxActorComponent == null)
        {
            Debug.LogWarning("Attempted to add an invalid hitbox to the hitbox manager. Please make sure that there is a HitboxActorComponent in the parent object of our hitbox");
            return;
        }

        if (!HitboxDictionary.ContainsKey(HitboxToAdd.HitboxActorComponent))
        {
            HitboxDictionary.Add(HitboxToAdd.HitboxActorComponent, new HashSet <EHHitbox>());
            AllHitboxActorComponentsList.Add(HitboxToAdd.HitboxActorComponent);
        }

        if (!HitboxDictionary[HitboxToAdd.HitboxActorComponent].Add(HitboxToAdd))
        {
            Debug.LogWarning("You are attempting to add a hitbox that has already been added to the hitbox manager.");
        }
    }
Пример #10
0
 private void OurHitboxEndintersectOtherHurtbox(EHHitbox OurHitbox, EHHitbox OtherHitbox)
 {
 }
Пример #11
0
 /// <summary>
 /// Method will be called if the hitbox that is passed in is not longer intersecting, if it was intersecting with this hitbox in the previous
 /// frame
 /// </summary>
 /// <param name="OtherHitbox"></param>
 private void HitboxEndOverlap(EHHitbox OtherHitbox)
 {
     IntersectingHitboxSet.Remove(OtherHitbox);
     OtherHitbox.IntersectingHitboxSet.Remove(this);
 }
Пример #12
0
 protected abstract bool IsHitboxOverlapping(EHHitbox OtherHitbox);