2022-12-17 01:26:37 +03:00

43 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Warship
{
internal class DrawingObjectWarship : IDrawingObject
{
private DrawingWarship _warship = null;
public DrawingObjectWarship(DrawingWarship warship)
{
_warship = warship;
}
public float Step => _warship?.Warship?.Step ?? 0;
void IDrawingObject.DrawingObject(Graphics g)
{
_warship.DrawTransport(g);
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _warship?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_warship?.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_warship.SetPosition(x, y, width, height);
}
public string GetInfo() => _warship?.GetDataForSave();
public static IDrawingObject Create(string data) => new DrawingObjectWarship(data.CreateDrawingWarship());
}
}