40 lines
1.2 KiB
C#
40 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace AirplaneWithRadar
|
|
{
|
|
internal class DrawningObjectAirplane : IDrawningObject
|
|
{
|
|
private DrawningAirplane _airplane = null;
|
|
public DrawningObjectAirplane(DrawningAirplane airplane)
|
|
{
|
|
_airplane = airplane;
|
|
}
|
|
public float Step => _airplane?.Airplane?.Step ?? 0;
|
|
public (float Left, float Top, float Right, float Bottom)
|
|
GetCurrentPosition()
|
|
{
|
|
return _airplane?.GetCurrentPosition() ?? default;
|
|
}
|
|
public void MoveObject(Direction direction)
|
|
{
|
|
_airplane?.MoveTransport(direction);
|
|
}
|
|
public void SetObject(int x, int y, int width, int height)
|
|
{
|
|
_airplane.SetPosition(x, y, width, height);
|
|
}
|
|
public void DrawningObject(Graphics g)
|
|
{
|
|
_airplane.DrawTransport(g);
|
|
}
|
|
|
|
public string GetInfo() => _airplane?.GetDataForSave();
|
|
public static IDrawningObject Create(string data) => new DrawningObjectAirplane(data.CreateDrawningAirplane());
|
|
|
|
}
|
|
}
|