mirror of
https://github.com/Phantop/LADXHD.git
synced 2024-11-01 04:14:22 +00:00
40 lines
1.1 KiB
C#
40 lines
1.1 KiB
C#
using Microsoft.Xna.Framework;
|
|
using ProjectZ.Base;
|
|
|
|
namespace ProjectZ.InGame.GameObjects.Base.CObjects
|
|
{
|
|
public class CRectangle
|
|
{
|
|
public RectangleF Rectangle;
|
|
public Rectangle OffsetSize;
|
|
|
|
private bool MoveZ;
|
|
|
|
public CRectangle(Rectangle rectangle)
|
|
{
|
|
Rectangle = rectangle;
|
|
}
|
|
|
|
public CRectangle(RectangleF rectangle)
|
|
{
|
|
Rectangle = rectangle;
|
|
}
|
|
|
|
public CRectangle(CPosition position, Rectangle offsetSize, bool moveZ = false)
|
|
{
|
|
OffsetSize = offsetSize;
|
|
position.AddPositionListener(typeof(CRectangle), UpdateRectangle);
|
|
UpdateRectangle(position);
|
|
MoveZ = moveZ;
|
|
}
|
|
|
|
public void UpdateRectangle(CPosition position)
|
|
{
|
|
Rectangle = new RectangleF(
|
|
position.X + OffsetSize.X,
|
|
position.Y + OffsetSize.Y + (MoveZ ? -position.Z : 0),
|
|
OffsetSize.Width, OffsetSize.Height);
|
|
}
|
|
}
|
|
}
|