From 3a9fee87bb43ecd1a1eb208aacd5ae6e3544b8a4 Mon Sep 17 00:00:00 2001 From: ShipilovNikita Date: Mon, 5 Feb 2024 11:23:37 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B4=D0=B2=D0=B0=20=D0=BA=D0=BB=D0=B0=D1=81=D1=81=D0=B0=20?= =?UTF-8?q?=D0=B8=20DirectionType?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectSeaplane/DirectionType.cs | 16 ++++++ .../ProjectSeaplane/DrawingSeaplane.cs | 51 +++++++++++++++++++ .../ProjectSeaplane/EntitySeaplane.cs | 23 +++++++++ 3 files changed, 90 insertions(+) create mode 100644 ProjectSeaplane/ProjectSeaplane/DirectionType.cs create mode 100644 ProjectSeaplane/ProjectSeaplane/DrawingSeaplane.cs create mode 100644 ProjectSeaplane/ProjectSeaplane/EntitySeaplane.cs diff --git a/ProjectSeaplane/ProjectSeaplane/DirectionType.cs b/ProjectSeaplane/ProjectSeaplane/DirectionType.cs new file mode 100644 index 0000000..91e7c91 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/DirectionType.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSeaplane; + +public enum DirectionType +{ + Up = 1, + Down = 2, + Left = 3, + Right = 4, +} + diff --git a/ProjectSeaplane/ProjectSeaplane/DrawingSeaplane.cs b/ProjectSeaplane/ProjectSeaplane/DrawingSeaplane.cs new file mode 100644 index 0000000..22fc7a8 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/DrawingSeaplane.cs @@ -0,0 +1,51 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSeaplane; +public class DrawingSeaplane +{ + public EntitySeaplane? EntitySeaplane {get;private set;} + + private int? _pictureWidth; + + private int? _pictureHeight; + + private int? _startPosX; + + private int? _startPosY; + + private readonly int _drawingSeaplaneWidth = 0; + + private readonly int _drawingSeaplaneHeight = 0; + public void Init (int speed, double weight, Color bodyColor, Color additionalColor) + { + EntitySeaplane = new EntitySeaplane(); + EntitySeaplane.Init(speed, weight, bodyColor, additionalColor); + _pictureHeight = null; + _pictureWidth = null; + _startPosX = null; + _startPosY = null; + } + + public bool SetPictureSize(int width, int height) + { + _pictureHeight = height; + _pictureWidth = width; + return true; + } + + public void SetPosition(int x, int y) + { + if (!_pictureHeight.HasValue || !_pictureWidth.HasValue) + { + return; + } + + _startPosY = y; + _startPosX = x; + } +} + diff --git a/ProjectSeaplane/ProjectSeaplane/EntitySeaplane.cs b/ProjectSeaplane/ProjectSeaplane/EntitySeaplane.cs new file mode 100644 index 0000000..6d95e48 --- /dev/null +++ b/ProjectSeaplane/ProjectSeaplane/EntitySeaplane.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace ProjectSeaplane; +public class EntitySeaplane +{ + public int Speed { get; set; } + public double Weight { get; set; } + public Color BodyColor { get; private set; } + public Color AdditionalColor { get; private set; } + public double Step => Speed * 100 / Weight; + public void Init(int speed, double weight, Color bodyColor, Color additionalColor) + { + Speed = speed; + Weight = weight; + BodyColor = bodyColor; + AdditionalColor = additionalColor; + } +} +