PIbd-23_Polevoy_S.V._SelfPr.../SelfPropelledArtilleryUnit/DrawingObjectArtillery.cs

45 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Artilleries
{
internal class DrawingObjectArtillery : IDrawingObject
{
private DrawingArtillery _artillery = null;
public DrawingObjectArtillery(DrawingArtillery artillery)
{
_artillery = artillery;
}
public float Step => _artillery?.Artillery?.Step ?? 0;
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _artillery?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_artillery?.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_artillery.SetPosition(x, y, width, height);
}
public void DrawingObject(Graphics g)
{
_artillery.DrawTransport(g);
}
public string GetInfo() => _artillery?.GetDateForSave();
public static IDrawingObject Create(string data) => new DrawingObjectArtillery(data.CreateDrawingArtillery());
}
}