38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using DumpTruck.DrawningObjects;
|
|
using DumpTruck.MovementStrategy;
|
|
|
|
namespace DumpTruck.MovementStrategy
|
|
{
|
|
internal class DrawningObjectCar : IMoveableObject
|
|
{
|
|
private readonly DrawningCar? _drawningCar = null;
|
|
public DrawningObjectCar(DrawningCar drawningCar)
|
|
{
|
|
_drawningCar = drawningCar;
|
|
}
|
|
public ObjectParameters? GetObjectPosition
|
|
{
|
|
get
|
|
{
|
|
if (_drawningCar == null || _drawningCar.EntityCar ==
|
|
null)
|
|
{
|
|
return null;
|
|
}
|
|
return new ObjectParameters(_drawningCar.GetPosX,
|
|
_drawningCar.GetPosY, _drawningCar.GetWidth, _drawningCar.GetHeight);
|
|
}
|
|
}
|
|
public int GetStep => (int)(_drawningCar?.EntityCar?.Step ?? 0);
|
|
public bool CheckCanMove(DirectionType direction) =>
|
|
_drawningCar?.CanMove(direction) ?? false;
|
|
public void MoveObject(DirectionType direction) =>
|
|
_drawningCar?.MoveTransport(direction);
|
|
}
|
|
}
|