Beispiel #1
0
    public static void BlockCollision(Blockbox obj1, Hitbox obj2)
    {
        if (obj1.mEntity.mEntityType == obj2.mEntity.mEntityType)
        {
            return;
        }

        if (obj2.mEntity is AttackObject proj)
        {
            if (proj.owner.mEntityType == obj1.mEntity.mEntityType)
            {
                return;
            }
        }


        if (obj1.mAABB.Overlaps(obj2.mAABB))
        {
            obj2.Blocked();
            //new CollisionData(hurtbox, new Vector2(overlapWidth, overlapHeight), hitbox.mSpeed, hurtbox.mSpeed, hitbox.mOldPosition, hurtbox.mOldPosition, hitbox.mPosition, hurtbox.mPosition));
            //hurtbox.mAllCollidingObjects.Add(new CollisionData(hitbox, -new Vector2(overlapWidth, overlapHeight), hurtbox.mSpeed, hitbox.mSpeed, hurtbox.mOldPosition, hitbox.mOldPosition, hurtbox.mPosition, hitbox.mPosition));
        }
    }