PIbd-22_Isaeva_A.I._Airbus_.../Airbus/MovementStrategy/DrawningObjectAirbus.cs
2023-11-18 10:00:43 +04:00

40 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ProjectAirbus.Drawnings;
using ProjectAirbus.Entities;
namespace ProjectAirbus.MovementStrategy
{
internal class DrawningObjectAirbus : IMoveableObject
{
private readonly DrawningAirbus? _drawningAirbus = null;
public DrawningObjectAirbus(DrawningAirbus drawningAirbus)
{
_drawningAirbus = drawningAirbus;
}
public ObjectParameters? GetObjectPosition
{
get
{
if (_drawningAirbus == null || _drawningAirbus.EntityAirbus == null)
{
return null;
}
return new ObjectParameters(_drawningAirbus.GetPosX, _drawningAirbus.GetPosY, _drawningAirbus.GetWidth, _drawningAirbus.GetHeight);
}
}
public int GetStep => (int)(_drawningAirbus?.EntityAirbus?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) => _drawningAirbus?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) => _drawningAirbus?.MoveTransport(direction);
}
}