Exemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj.GetType() != typeof(RectangleHitBox))
            {
                return(false);
            }

            RectangleHitBox rhb = (RectangleHitBox)obj;

            if (XOffset != rhb.XOffset)
            {
                return(false);
            }
            if (YOffset != rhb.YOffset)
            {
                return(false);
            }
            if (ActionName != rhb.ActionName)
            {
                return(false);
            }
            if (Width != rhb.Width)
            {
                return(false);
            }
            if (Height != rhb.Height)
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 2
0
        public override HitBox GetFlippedBox(bool FlipX, bool FlipY, int midX, int midY)
        {
            int deltaX = XOffset + Width - midX;
            int deltaY = YOffset + Height - midY;

            RectangleHitBox rhb = new RectangleHitBox();

            if (FlipX)
            {
                rhb.XOffset = midX - deltaX;
            }
            else
            {
                rhb.XOffset = XOffset;
            }
            if (FlipY)
            {
                rhb.YOffset = midY - deltaY;
            }
            else
            {
                rhb.YOffset = YOffset;
            }
            rhb.Width      = Width;
            rhb.Height     = Height;
            rhb.ActionName = ActionName;
            return(rhb);
        }
Exemplo n.º 3
0
        public override HitBox Clone()
        {
            RectangleHitBox rhb = new RectangleHitBox
            {
                Width       = Width,
                Height      = Height,
                Name        = Name,
                XOffset     = XOffset,
                YOffset     = YOffset,
                BorderColor = BorderColor,
                FrontColor  = FrontColor,
                Type        = Type,
                ActionName  = ActionName,
                Size        = Size
            };

            return(rhb);
        }
Exemplo n.º 4
0
        public virtual HitBox ToHitBox()
        {
            HitBox hb;

            switch (Type)
            {
            case 0:
                hb = new RectangleHitBox();
                break;

            default:
                hb = new InteractionPoint();
                break;
            }

            hb.Name        = Name;
            hb.XOffset     = XOffset;
            hb.YOffset     = YOffset;
            hb.BorderColor = Color.FromArgb(BorderColorA, BorderColorR, BorderColorG, BorderColorB);
            hb.FrontColor  = Color.FromArgb(FrontColorA, FrontColorR, FrontColorG, FrontColorB);
            hb.ActionName  = ActionName;

            return(hb);
        }