37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
|
using AirBomber.Rendering;
|
|||
|
|
|||
|
namespace AirBomber.MovementStrategy
|
|||
|
{
|
|||
|
public class ObjectEntityRenderer : IMovableObject
|
|||
|
{
|
|||
|
private readonly BomberRendererBase? _entityRenderer = null;
|
|||
|
|
|||
|
public ObjectEntityRenderer(BomberRendererBase? EntityRenderer)
|
|||
|
{
|
|||
|
_entityRenderer = EntityRenderer;
|
|||
|
}
|
|||
|
|
|||
|
public ObjectParameters? ObjectPosition
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_entityRenderer is null || _entityRenderer.EntityBomber is null)
|
|||
|
return null;
|
|||
|
|
|||
|
return new ObjectParameters(
|
|||
|
_entityRenderer.PosX,
|
|||
|
_entityRenderer.PosY,
|
|||
|
_entityRenderer.EntityWidth,
|
|||
|
_entityRenderer.EntityHeight
|
|||
|
);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public int Step => (int)(_entityRenderer?.EntityBomber?.Step ?? 0);
|
|||
|
|
|||
|
public bool CanMove(DirectionType Direction) => _entityRenderer?.CanMove(Direction) ?? false;
|
|||
|
|
|||
|
public void MoveObject(DirectionType Direction) => _entityRenderer?.MoveEntity(Direction);
|
|||
|
}
|
|||
|
}
|