From b83531e445ffe52dc71f5900386be6c627501da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D1=80=D1=82=D1=91=D0=BC=20=D0=90=D0=BB=D0=B5=D0=B9?= =?UTF-8?q?=D0=BA=D0=B8=D0=BD?= Date: Tue, 4 Oct 2022 18:24:13 +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 --- AirBomber/AirBomber/DrawningBomber.cs | 5 +++ AirBomber/AirBomber/DrawningObjectBomber.cs | 40 +++++++++++++++++++++ AirBomber/AirBomber/IDrawningObject.cs | 21 +++++++++++ 3 files changed, 66 insertions(+) create mode 100644 AirBomber/AirBomber/DrawningObjectBomber.cs create mode 100644 AirBomber/AirBomber/IDrawningObject.cs diff --git a/AirBomber/AirBomber/DrawningBomber.cs b/AirBomber/AirBomber/DrawningBomber.cs index ed8491e..d9f1ee5 100644 --- a/AirBomber/AirBomber/DrawningBomber.cs +++ b/AirBomber/AirBomber/DrawningBomber.cs @@ -130,5 +130,10 @@ namespace AirBomber _startPosY = _pictureHeight.Value - _airBomberHeight; } } + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return (_startPosX, _startPosY, _startPosX + _airBomberWidth, _airBomberHeight); + } } } diff --git a/AirBomber/AirBomber/DrawningObjectBomber.cs b/AirBomber/AirBomber/DrawningObjectBomber.cs new file mode 100644 index 0000000..71d23ba --- /dev/null +++ b/AirBomber/AirBomber/DrawningObjectBomber.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal class DrawningObjectBomber : IDrawningObject + { + private DrawningBomber _airBomber = null; + + public DrawningObjectBomber(DrawningBomber airBomber) + { + _airBomber = airBomber; + } + + public float Step => _airBomber?.AirBomber?.Step ?? 0; + + public (float Left, float Right, float Top, float Bottom) GetCurrentPosition() + { + return _airBomber?.GetCurrentPosition() ?? default; + } + + public void MoveObject(Direction direction) + { + _airBomber?.MoveTransport(direction); + } + + public void SetObject(int x, int y, int width, int height) + { + _airBomber.SetPosition(x, y, width, height); + } + + public void DrawningObject(Graphics g) + { + + } + } +} diff --git a/AirBomber/AirBomber/IDrawningObject.cs b/AirBomber/AirBomber/IDrawningObject.cs new file mode 100644 index 0000000..02ba166 --- /dev/null +++ b/AirBomber/AirBomber/IDrawningObject.cs @@ -0,0 +1,21 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace AirBomber +{ + internal interface IDrawningObject + { + public float Step { get; } + + void SetObject(int x, int y, int width, int height); + + void MoveObject(Direction direction); + + void DrawningObject(Graphics g); + + (float Left, float Right, float Top, float Bottom) GetCurrentPosition(); + } +}