experiments-monogame/Dakota/Dakota/Space/NoFlyZone.cs

36 lines
No EOL
1.1 KiB
C#

using Dakota.Data;
using Nez;
namespace Dakota.Space
{
public class NoFlyZone : RenderableComponent
{
public override float Width => 800;
public override float Height => 800;
private int _padding;
private RectangleF _innerRect;
private RectangleF _outerRect;
public NoFlyZone(int padding)
{
_padding = padding;
}
public override void OnAddedToEntity()
{
var scene = (SpaceScene) Entity.Scene;
_innerRect = new RectangleF(_padding, _padding, scene.CurrentZone.Width - _padding,
scene.CurrentZone.Height - _padding);
_outerRect = new RectangleF(_padding - 10, _padding - 10, scene.CurrentZone.Width - _padding + 20,
scene.CurrentZone.Height - _padding + 20);
}
public override void Render(Batcher batcher, Camera camera)
{
// terrible looking, what should this look like?
batcher.DrawHollowRect(_innerRect, GameConstants.NoFlyZoneColor);
batcher.DrawHollowRect(_outerRect, GameConstants.NoFlyZoneColor);
}
}
}