From 88725c47034985075d4464f88940b1c9f77b67da Mon Sep 17 00:00:00 2001 From: Yuee Shiness Date: Mon, 26 Sep 2022 21:28:41 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BD=D1=82=D0=B5=D1=80=D1=84=D0=B5?= =?UTF-8?q?=D0=B9=D1=81=D0=B0.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AirFighter/DrawingAircraft.cs | 5 ++++ AirFighter/DrawingObjectAircraft.cs | 42 +++++++++++++++++++++++++++++ AirFighter/IDrawingObject.cs | 21 +++++++++++++++ 3 files changed, 68 insertions(+) create mode 100644 AirFighter/DrawingObjectAircraft.cs create mode 100644 AirFighter/IDrawingObject.cs diff --git a/AirFighter/DrawingAircraft.cs b/AirFighter/DrawingAircraft.cs index 8647957..a73856d 100644 --- a/AirFighter/DrawingAircraft.cs +++ b/AirFighter/DrawingAircraft.cs @@ -241,5 +241,10 @@ namespace AirFighter } } + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return (_startPosX, _startPosY, _startPosX + _aircraftWidth, _startPosY + _aircraftHeight); + } } } diff --git a/AirFighter/DrawingObjectAircraft.cs b/AirFighter/DrawingObjectAircraft.cs new file mode 100644 index 0000000..9f745a5 --- /dev/null +++ b/AirFighter/DrawingObjectAircraft.cs @@ -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); + } + + } + +} diff --git a/AirFighter/IDrawingObject.cs b/AirFighter/IDrawingObject.cs new file mode 100644 index 0000000..c6a9e72 --- /dev/null +++ b/AirFighter/IDrawingObject.cs @@ -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(); + + } +}