Pibd-22_Presnyakova.V.V_Cat.../Catamaran/DrawingObjectBoat.cs

40 lines
1.2 KiB
C#
Raw Normal View History

2022-10-01 20:41:57 +04:00
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Catamaran
{
internal class DrawingObjectBoat : IDrawingObject
{
private DrawingBoat _catamaran = null;
public DrawingObjectBoat(DrawingBoat catamaran)
{
_catamaran = catamaran;
}
public float Step => _catamaran?.Catamaran?.Step ?? 0;
public (float Left, float Right, float Top, float Bottom)
GetCurrentPosition()
{
return _catamaran?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_catamaran?.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
2022-11-20 23:55:50 +04:00
_catamaran?.SetPosition(x, y, width, height);
2022-10-01 20:41:57 +04:00
}
public void DrawingObject(Graphics g)
{
2022-11-20 23:55:50 +04:00
_catamaran?.DrawTransport(g);
2022-10-01 20:41:57 +04:00
}
2022-11-20 20:46:00 +04:00
public string GetInfo() => _catamaran?.GetDataForSave();
public static IDrawingObject Create(string data) => new DrawingObjectBoat(data.CreateDrawingBoat());
2022-10-01 20:41:57 +04:00
}
}