37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
using System.Threading.Tasks;
|
|||
|
using Hydroplane.DrawningObjects;
|
|||
|
|
|||
|
namespace Hydroplane.MovementStrategy
|
|||
|
{
|
|||
|
public class DrawningObjectPlane : IMoveableObject
|
|||
|
{
|
|||
|
private readonly DrawningPlane? _drawingPlane = null;
|
|||
|
public DrawningObjectPlane(DrawningPlane drawingPlane)
|
|||
|
{
|
|||
|
_drawingPlane = drawingPlane;
|
|||
|
}
|
|||
|
public ObjectParameters? GetObjectPosition
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
if (_drawingPlane == null || _drawingPlane.EntityPlane == null)
|
|||
|
{
|
|||
|
return null;
|
|||
|
}
|
|||
|
return new ObjectParameters(_drawingPlane.GetPosX,
|
|||
|
_drawingPlane.GetPosY, _drawingPlane.GetWidth, _drawingPlane.GetHeight);
|
|||
|
}
|
|||
|
}
|
|||
|
public int GetStep => (int)(_drawingPlane?.EntityPlane?.Step ?? 0);
|
|||
|
public bool CheckCanMove(DirectionType direction) =>
|
|||
|
_drawingPlane?.CanMove(direction) ?? false;
|
|||
|
public void MoveObject(DirectionType direction) =>
|
|||
|
_drawingPlane?.MoveTransport(direction);
|
|||
|
|
|||
|
}
|
|||
|
}
|