PIbd22_Kuznetsov_A.V._Excav.../Excavator/DrawingObjectMash.cs

35 lines
1.2 KiB
C#
Raw Normal View History

2023-12-15 21:24:31 +04:00
using Excavator.MovementStrategy;
using Excavator;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading.Tasks;
using Excavator.DrawingObjects;
namespace Excavator.MovementStrategy
{
public class DrawingObjectMash : IMoveableObject
{
2023-12-15 21:34:14 +04:00
private readonly DrawingMash? _drawingMash = null;
public DrawingObjectMash(DrawingMash drawingMash)
2023-12-15 21:24:31 +04:00
{
2023-12-15 21:34:14 +04:00
_drawingMash = drawingMash;
2023-12-15 21:24:31 +04:00
}
public ObjectParameters? GetObjectPosition
{
get
{
2023-12-15 21:34:14 +04:00
if (_drawingMash == null || _drawingMash.EntityMash == null)
2023-12-15 21:24:31 +04:00
{
return null;
}
2023-12-15 21:34:14 +04:00
return new ObjectParameters(_drawingMash.GetPosX,_drawingMash.GetPosY, _drawingMash.GetWidth, _drawingMash.GetHeight);
2023-12-15 21:24:31 +04:00
}
}
2023-12-15 21:34:14 +04:00
public int GetStep => (int)(_drawingMash?.EntityMash?.Step ?? 0);
public bool CheckCanMove(DirectionType direction) => _drawingMash?.CanMove(direction) ?? false;
public void MoveObject(DirectionType direction) => _drawingMash?.MoveTransport(direction);
2023-12-15 21:24:31 +04:00
}
}