Добавление интерфейса.

This commit is contained in:
Yuee Shiness 2022-09-26 21:28:41 +04:00
parent 6c1da36415
commit 88725c4703
3 changed files with 68 additions and 0 deletions

View File

@ -241,5 +241,10 @@ namespace AirFighter
}
}
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return (_startPosX, _startPosY, _startPosX + _aircraftWidth, _startPosY + _aircraftHeight);
}
}
}

View File

@ -0,0 +1,42 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirFighter
{
internal class DrawingObjectAircraft : IDrawingObject
{
private DrawingAircraft _aircraft = null;
public DrawingObjectAircraft(DrawingAircraft aircraft)
{
_aircraft = aircraft;
}
public float Step => _aircraft.Plane?.Step ?? 0;
public (float Left, float Right, float Top, float Bottom) GetCurrentPosition()
{
return _aircraft?.GetCurrentPosition() ?? default;
}
public void MoveObject(Direction direction)
{
_aircraft.MoveTransport(direction);
}
public void SetObject(int x, int y, int width, int height)
{
_aircraft.SetPosition(x, y, width, height);
}
void IDrawingObject.DrawingObject(Graphics g)
{
_aircraft.DrawTransport(g);
}
}
}

View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AirFighter
{
internal interface IDrawingObject
{
public float Step { get; }
void SetObject(int x, int y, int width, int height);
void MoveObject(Direction direction);
void DrawingObject(Graphics g);
(float Left, float Right, float Top, float Bottom) GetCurrentPosition();
}
}