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