Exemplo n.º 1
0
        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;
                }
            }
        }
Exemplo n.º 2
0
 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);
     }
 }
Exemplo n.º 3
0
 public abstract bool Intersects(Hitbox hitbox);
Exemplo n.º 4
0
        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));
        }