예제 #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;
                }
            }
        }
예제 #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);
     }
 }
예제 #3
0
 public abstract bool Intersects(Hitbox hitbox);
예제 #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));
        }