public void FindTopHitbox() { previousTopHitbox = topHitbox; if (hitboxesMouseOver.Count > 0) { topHitbox = hitboxesMouseOver[0]; } foreach (Hitbox hb in hitboxesMouseOver) { if (hb.gameObject.transform.LayerDepth < topHitbox.gameObject.transform.LayerDepth) { topHitbox = hb; } } }
public override bool Intersects(Hitbox hitbox) { if (hitbox.shape == HitboxShape.Rectangle) { Rectangle intersect = Rectangle.Intersect(RectangleHB(), hitbox.RectangleHB()); if (intersect.Width != 0 || intersect.Height != 0) { return(true); } else { return(false); } } else { return(false); } }
public abstract bool Intersects(Hitbox hitbox);
public Hitbox MakeHitbox() { Transform hitboxTransform = new Transform(this.transform, this.transform.Texture, new Vector2(0, 0)); return(this.hitbox = new RectangleHitbox(hitboxTransform, new Vector3(transform.Size, 0), this)); }