PIbd-23_Dyakonov_R_R_Tank/ProjectTank/MovementStrategy/DrawningObjectTank.cs

31 lines
1.1 KiB
C#
Raw Permalink Normal View History

2023-10-03 13:32:33 +04:00
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);
}
}