2023-10-12 17:09:31 +04:00

39 lines
1.2 KiB
C#

using ProjectAirBomber.MovementStrategy;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProjectAirBomber.DrawingObjects;
namespace ProjectAirBomber.MovementStrategy
{
public class DrawingObjectPlane : IMoveableObject
{
private readonly DrawingPlane? _drawningPlane = null;
public DrawingObjectPlane(DrawingPlane drawingPlane)
{
_drawningPlane = drawingPlane;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawningPlane == null || _drawningPlane.EntityPlane ==
null)
{
return null;
}
return new ObjectParameters(_drawningPlane.GetPosX,
_drawningPlane.GetPosY, _drawningPlane.GetWidth, _drawningPlane.GetHeight);
}
}
public int GetStep => (int)(_drawningPlane?.EntityPlane?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) =>
_drawningPlane?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) =>
_drawningPlane?.MoveTransport(direction);
}
}