// Get the collision state with another world object // <obj> the other world object public Hitbox.CollisionSide CollidesSide(WorldObject obj) { if (obj == null || obj.WorldNode == null || obj.WorldHitbox == null || WorldNode == null || WorldHitbox == null || obj.WorldNode.IsDeleted || WorldNode.IsDeleted) { return(null); } return(WorldHitbox.IntersectsSide(obj.WorldHitbox, WorldNode.Position2D, obj.WorldNode.Position2D)); }
// Checks if the object collides with another object // <obj> is the other world object public bool Collides(WorldObject obj) { if (obj == null || obj.WorldNode == null || obj.WorldHitbox == null || WorldNode == null || WorldHitbox == null || obj.WorldNode.IsDeleted || WorldNode.IsDeleted) { return(false); } try { return(WorldHitbox.Intersects(obj.WorldHitbox, WorldNode.Position2D, obj.WorldNode.Position2D)); } catch { // most likely caused by knife already hitting player // so ignore error return(false); } }