diff --git a/SpeedBoat/SpeedBoat/Form1.Designer.cs b/SpeedBoat/SpeedBoat/Form1.Designer.cs
deleted file mode 100644
index fda54de..0000000
--- a/SpeedBoat/SpeedBoat/Form1.Designer.cs
+++ /dev/null
@@ -1,41 +0,0 @@
-
-namespace SpeedBoat
-{
- partial class Form1
- {
- ///
- /// Required designer variable.
- ///
- private System.ComponentModel.IContainer components = null;
-
- ///
- /// Clean up any resources being used.
- ///
- /// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
-
- #region Windows Form Designer generated code
-
- ///
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- ///
- private void InitializeComponent()
- {
- this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(800, 450);
- this.Text = "Form1";
- }
-
- #endregion
- }
-}
-
diff --git a/SpeedBoat/SpeedBoat/Form1.cs b/SpeedBoat/SpeedBoat/Form1.cs
deleted file mode 100644
index 5726264..0000000
--- a/SpeedBoat/SpeedBoat/Form1.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows.Forms;
-
-namespace SpeedBoat
-{
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
-
- }
-}
diff --git a/SpeedBoat/SpeedBoat/SpeedBoat.csproj b/SpeedBoat/SpeedBoat/SpeedBoat.csproj
deleted file mode 100644
index a2d4310..0000000
--- a/SpeedBoat/SpeedBoat/SpeedBoat.csproj
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- WinExe
- net5.0-windows
- true
-
-
-
\ No newline at end of file
diff --git a/SpeedBoat/SpeedBoat.sln b/speed_Boat/speed_Boat.sln
similarity index 59%
rename from SpeedBoat/SpeedBoat.sln
rename to speed_Boat/speed_Boat.sln
index 65a7012..35dedd7 100644
--- a/SpeedBoat/SpeedBoat.sln
+++ b/speed_Boat/speed_Boat.sln
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31729.503
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpeedBoat", "SpeedBoat\SpeedBoat.csproj", "{CA504B35-DFE8-449C-97F5-02C7D392541A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "speed_Boat", "speed_Boat\speed_Boat.csproj", "{69814DF7-C284-4ACE-A27E-C43EAA333896}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -11,15 +11,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {CA504B35-DFE8-449C-97F5-02C7D392541A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {CA504B35-DFE8-449C-97F5-02C7D392541A}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {CA504B35-DFE8-449C-97F5-02C7D392541A}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {CA504B35-DFE8-449C-97F5-02C7D392541A}.Release|Any CPU.Build.0 = Release|Any CPU
+ {69814DF7-C284-4ACE-A27E-C43EAA333896}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {69814DF7-C284-4ACE-A27E-C43EAA333896}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {69814DF7-C284-4ACE-A27E-C43EAA333896}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {69814DF7-C284-4ACE-A27E-C43EAA333896}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {74698B56-6881-4BCE-9439-4D163E6F4EC5}
+ SolutionGuid = {BAB091BF-94E7-44DA-94F6-70065AB46382}
EndGlobalSection
EndGlobal
diff --git a/speed_Boat/speed_Boat/Direction.cs b/speed_Boat/speed_Boat/Direction.cs
new file mode 100644
index 0000000..ee9bc9e
--- /dev/null
+++ b/speed_Boat/speed_Boat/Direction.cs
@@ -0,0 +1,32 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SpeedBoatLab
+{
+ ///
+ /// Направление перемещения
+ ///
+ public enum DirectionType
+ {
+ ///
+ /// Вверх
+ ///
+ Up = 1,
+ ///
+ /// Вниз
+ ///
+ Down = 2,
+ ///
+ /// Влево
+ ///
+ Left = 3,
+ ///
+ /// Вправо
+ ///
+ Right = 4
+ }
+
+}
diff --git a/speed_Boat/speed_Boat/FormSpeedBoat.Designer.cs b/speed_Boat/speed_Boat/FormSpeedBoat.Designer.cs
new file mode 100644
index 0000000..ce07184
--- /dev/null
+++ b/speed_Boat/speed_Boat/FormSpeedBoat.Designer.cs
@@ -0,0 +1,143 @@
+
+namespace SpeedBoatLab
+{
+ partial class FormSpeedBoat
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.pictureBoxSpeedBoat = new System.Windows.Forms.PictureBox();
+ this.buttonCreate = new System.Windows.Forms.Button();
+ this.buttonUp = new System.Windows.Forms.Button();
+ this.buttonLeft = new System.Windows.Forms.Button();
+ this.buttonDown = new System.Windows.Forms.Button();
+ this.buttonRight = new System.Windows.Forms.Button();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSpeedBoat)).BeginInit();
+ this.SuspendLayout();
+ //
+ // pictureBoxSpeedBoat
+ //
+ this.pictureBoxSpeedBoat.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.pictureBoxSpeedBoat.Location = new System.Drawing.Point(0, 0);
+ this.pictureBoxSpeedBoat.Name = "pictureBoxSpeedBoat";
+ this.pictureBoxSpeedBoat.Size = new System.Drawing.Size(800, 450);
+ this.pictureBoxSpeedBoat.TabIndex = 0;
+ this.pictureBoxSpeedBoat.TabStop = false;
+ //
+ // buttonCreate
+ //
+ this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonCreate.BackColor = System.Drawing.Color.White;
+ this.buttonCreate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonCreate.Location = new System.Drawing.Point(12, 387);
+ this.buttonCreate.Name = "buttonCreate";
+ this.buttonCreate.Size = new System.Drawing.Size(103, 51);
+ this.buttonCreate.TabIndex = 2;
+ this.buttonCreate.Text = "Создать обьект";
+ this.buttonCreate.UseVisualStyleBackColor = false;
+ this.buttonCreate.Click += new System.EventHandler(this.buttonCreate_Click);
+ //
+ // buttonUp
+ //
+ this.buttonUp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonUp.BackgroundImage = global::speed_Boat.Properties.Resources.UP;
+ this.buttonUp.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonUp.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonUp.Location = new System.Drawing.Point(716, 372);
+ this.buttonUp.Name = "buttonUp";
+ this.buttonUp.Size = new System.Drawing.Size(30, 30);
+ this.buttonUp.TabIndex = 10;
+ this.buttonUp.UseVisualStyleBackColor = true;
+ this.buttonUp.Click += new System.EventHandler(this.buttonMove_Click);
+ //
+ // buttonLeft
+ //
+ this.buttonLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonLeft.BackgroundImage = global::speed_Boat.Properties.Resources.LEFT;
+ this.buttonLeft.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonLeft.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonLeft.Location = new System.Drawing.Point(680, 408);
+ this.buttonLeft.Name = "buttonLeft";
+ this.buttonLeft.Size = new System.Drawing.Size(30, 30);
+ this.buttonLeft.TabIndex = 9;
+ this.buttonLeft.UseVisualStyleBackColor = true;
+ this.buttonLeft.Click += new System.EventHandler(this.buttonMove_Click);
+ //
+ // buttonDown
+ //
+ this.buttonDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonDown.BackgroundImage = global::speed_Boat.Properties.Resources.DOWN;
+ this.buttonDown.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonDown.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonDown.Location = new System.Drawing.Point(716, 408);
+ this.buttonDown.Name = "buttonDown";
+ this.buttonDown.Size = new System.Drawing.Size(30, 30);
+ this.buttonDown.TabIndex = 8;
+ this.buttonDown.UseVisualStyleBackColor = true;
+ this.buttonDown.Click += new System.EventHandler(this.buttonMove_Click);
+ //
+ // buttonRight
+ //
+ this.buttonRight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonRight.BackgroundImage = global::speed_Boat.Properties.Resources.RIGHT;
+ this.buttonRight.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
+ this.buttonRight.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
+ this.buttonRight.Location = new System.Drawing.Point(752, 408);
+ this.buttonRight.Name = "buttonRight";
+ this.buttonRight.Size = new System.Drawing.Size(30, 30);
+ this.buttonRight.TabIndex = 7;
+ this.buttonRight.UseVisualStyleBackColor = true;
+ this.buttonRight.Click += new System.EventHandler(this.buttonMove_Click);
+ //
+ // FormSpeedBoat
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(800, 450);
+ this.Controls.Add(this.buttonUp);
+ this.Controls.Add(this.buttonLeft);
+ this.Controls.Add(this.buttonDown);
+ this.Controls.Add(this.buttonRight);
+ this.Controls.Add(this.buttonCreate);
+ this.Controls.Add(this.pictureBoxSpeedBoat);
+ this.Name = "FormSpeedBoat";
+ this.Text = "Движение катера";
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBoxSpeedBoat)).EndInit();
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.PictureBox pictureBoxSpeedBoat;
+ private System.Windows.Forms.Button buttonCreate;
+ private System.Windows.Forms.Button buttonUp;
+ private System.Windows.Forms.Button buttonLeft;
+ private System.Windows.Forms.Button buttonDown;
+ private System.Windows.Forms.Button buttonRight;
+ }
+}
+
diff --git a/speed_Boat/speed_Boat/FormSpeedBoat.cs b/speed_Boat/speed_Boat/FormSpeedBoat.cs
new file mode 100644
index 0000000..7239e35
--- /dev/null
+++ b/speed_Boat/speed_Boat/FormSpeedBoat.cs
@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace SpeedBoatLab
+{
+ public partial class FormSpeedBoat : Form
+ {
+ ///
+ /// Поле-объект для прорисовки объекта
+ ///
+ private SpeedBoatMovement? _tankerMovement;
+ public FormSpeedBoat()
+ {
+ InitializeComponent();
+ }
+
+ ///
+ /// Метод прорисовки машины
+ ///
+ private void Draw()
+ {
+ if (_tankerMovement == null)
+ {
+ return;
+ }
+
+ Bitmap bmp = new(pictureBoxSpeedBoat.Width, pictureBoxSpeedBoat.Height);
+ Graphics gr = Graphics.FromImage(bmp);
+ _tankerMovement.DrawTransport(gr);
+ pictureBoxSpeedBoat.Image = bmp;
+ }
+
+ ///
+ /// Обработка создания обьекта
+ ///
+ private void buttonCreate_Click(object sender, EventArgs e)
+ {
+ Random random = new();
+ _tankerMovement = new SpeedBoatMovement();
+
+ _tankerMovement.Init(random.Next(100, 300),
+ random.Next(1000, 3000),
+ Convert.ToBoolean(random.Next(0, 2)),
+ Convert.ToBoolean(random.Next(0, 2)),
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
+ Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
+ pictureBoxSpeedBoat.Width, pictureBoxSpeedBoat.Height);
+
+ //startXCoord and startYCoord
+ _tankerMovement.SetPosition(random.Next(10, 100), random.Next(10, 100));
+
+ Draw();
+ }
+
+ ///
+ /// Обработка движения обьекта
+ ///
+ private void buttonMove_Click(object sender, EventArgs e)
+ {
+ if (_tankerMovement == null)
+ {
+ return;
+ }
+ string name = ((Button)sender)?.Name ?? string.Empty;
+ switch (name)
+ {
+ case "buttonUp":
+ _tankerMovement.MoveTransport(DirectionType.Up);
+ break;
+ case "buttonDown":
+ _tankerMovement.MoveTransport(DirectionType.Down);
+ break;
+ case "buttonLeft":
+ _tankerMovement.MoveTransport(DirectionType.Left);
+ break;
+ case "buttonRight":
+ _tankerMovement.MoveTransport(DirectionType.Right);
+ break;
+ }
+ Draw();
+ }
+ }
+}
diff --git a/speed_Boat/speed_Boat/FormSpeedBoat.resx b/speed_Boat/speed_Boat/FormSpeedBoat.resx
new file mode 100644
index 0000000..f298a7b
--- /dev/null
+++ b/speed_Boat/speed_Boat/FormSpeedBoat.resx
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file
diff --git a/SpeedBoat/SpeedBoat/Program.cs b/speed_Boat/speed_Boat/Program.cs
similarity index 87%
rename from SpeedBoat/SpeedBoat/Program.cs
rename to speed_Boat/speed_Boat/Program.cs
index b0ea8a7..63c0040 100644
--- a/SpeedBoat/SpeedBoat/Program.cs
+++ b/speed_Boat/speed_Boat/Program.cs
@@ -4,7 +4,7 @@ using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
-namespace SpeedBoat
+namespace SpeedBoatLab
{
static class Program
{
@@ -17,7 +17,7 @@ namespace SpeedBoat
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
- Application.Run(new Form1());
+ Application.Run(new FormSpeedBoat());
}
}
}
diff --git a/speed_Boat/speed_Boat/Properties/Resources.Designer.cs b/speed_Boat/speed_Boat/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..2a3409d
--- /dev/null
+++ b/speed_Boat/speed_Boat/Properties/Resources.Designer.cs
@@ -0,0 +1,103 @@
+//------------------------------------------------------------------------------
+//
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
+//
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
+//
+//------------------------------------------------------------------------------
+
+namespace speed_Boat.Properties {
+ using System;
+
+
+ ///
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
+ ///
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ ///
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("speed_Boat.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap DOWN {
+ get {
+ object obj = ResourceManager.GetObject("DOWN", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap LEFT {
+ get {
+ object obj = ResourceManager.GetObject("LEFT", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap RIGHT {
+ get {
+ object obj = ResourceManager.GetObject("RIGHT", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
+ ///
+ /// Поиск локализованного ресурса типа System.Drawing.Bitmap.
+ ///
+ internal static System.Drawing.Bitmap UP {
+ get {
+ object obj = ResourceManager.GetObject("UP", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+ }
+}
diff --git a/SpeedBoat/SpeedBoat/Form1.resx b/speed_Boat/speed_Boat/Properties/Resources.resx
similarity index 84%
rename from SpeedBoat/SpeedBoat/Form1.resx
rename to speed_Boat/speed_Boat/Properties/Resources.resx
index 1af7de1..985fdea 100644
--- a/SpeedBoat/SpeedBoat/Form1.resx
+++ b/speed_Boat/speed_Boat/Properties/Resources.resx
@@ -117,4 +117,17 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\resources\DOWN.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\resources\LEFT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\resources\RIGHT.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\resources\UP.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/speed_Boat/speed_Boat/SpeedBoat.cs b/speed_Boat/speed_Boat/SpeedBoat.cs
new file mode 100644
index 0000000..8f46029
--- /dev/null
+++ b/speed_Boat/speed_Boat/SpeedBoat.cs
@@ -0,0 +1,58 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Drawing;
+
+namespace SpeedBoatLab
+{
+ public class SpeedBoat
+ {
+ ///
+ /// Скорость катера
+ ///
+ public int Speed { get; private set; }
+
+ ///
+ /// Вес самого катера
+ ///
+ public double Weight { get; private set; }
+
+ ///
+ /// Наличие мотора
+ ///
+ public bool isMotor { get; private set; }
+
+ ///
+ /// Наличие защитного стекла
+ ///
+ public bool isProtectedGlass { get; private set; }
+
+ ///
+ /// Основной цвет
+ ///
+ public Color MainColor { get; private set; }
+
+ ///
+ /// Доп. цвет
+ ///
+ public Color SecondColor { get; private set; }
+
+ ///
+ /// Шаг перемещения катера
+ ///
+ public double Step => (double)Speed * 100 / (Weight);
+
+ public void Init(int speed, double weight, bool _isMotor, bool _isProtectedGlass, Color mainColor, Color secondColor)
+ {
+ Speed = speed;
+ Weight = weight;
+ isMotor = _isMotor;
+ isProtectedGlass = _isProtectedGlass;
+ MainColor = mainColor;
+ SecondColor = secondColor;
+ }
+
+ }
+}
diff --git a/speed_Boat/speed_Boat/SpeedBoatMovement.cs b/speed_Boat/speed_Boat/SpeedBoatMovement.cs
new file mode 100644
index 0000000..10de65e
--- /dev/null
+++ b/speed_Boat/speed_Boat/SpeedBoatMovement.cs
@@ -0,0 +1,182 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using SpeedBoatLab;
+using System.Drawing;
+
+
+namespace SpeedBoatLab
+{
+ class SpeedBoatMovement
+ {
+ ///
+ /// Класс-сущность
+ ///
+ public SpeedBoat? _speedBoat { get; private set; }
+
+ ///
+ /// Ширина окна
+ ///
+ private int screenWidth;
+ ///
+ /// Высота окна
+ ///
+ private int screenHeight;
+
+ ///
+ /// Х-координата обьекта
+ ///
+ private int startXCoord;
+ ///
+ /// Y-координата обьекта
+ ///
+ private int startYCoord;
+
+ ///
+ /// Ширина обьекта
+ ///
+ private readonly int widthBoat = 100;
+ ///
+ /// Высота обьекта
+ ///
+ private readonly int heightBoat = 80;
+
+ public bool Init(int speed, double weight, bool _isMotor, bool _isProtectedGlass, Color mainColor, Color secondColor, int width, int height)
+ {
+ screenWidth = width;
+ screenHeight = height;
+ _speedBoat = new SpeedBoat();
+ _speedBoat.Init(speed, weight, _isMotor, _isProtectedGlass, mainColor, secondColor);
+
+ ///
+ /// Проверка на вместимость обьекта в рамки сцены
+ ///
+ if ((widthBoat >= screenWidth) || (heightBoat >= screenHeight))
+ {
+ Console.WriteLine("проверка не пройдена, нельзя создать объект в этих размерах");
+ return false;
+ }
+ else
+ Console.WriteLine("объект создан");
+ return true;
+ }
+
+ ///
+ /// Установка позиции
+ ///
+ public void SetPosition(int x, int y)
+ {
+ if ((x + widthBoat > screenWidth) || (y + heightBoat > screenHeight))
+ {
+ startXCoord = screenWidth - widthBoat;
+ startYCoord = screenHeight - heightBoat;
+ }
+ else
+ {
+ startXCoord = x;
+ startYCoord = y;
+ }
+
+ }
+ ///
+ /// Изменение направления перемещения
+ ///
+ public void MoveTransport(DirectionType direction)
+ {
+ if (_speedBoat == null)
+ {
+ return;
+ }
+
+ switch (direction)
+ {
+ //влево
+ case DirectionType.Left:
+ if (startXCoord - _speedBoat.Step > 0)
+ {
+ startXCoord -= (int)_speedBoat.Step;
+ }
+ break;
+ //вверх
+ case DirectionType.Up:
+ if (startYCoord - _speedBoat.Step > 0)
+ {
+ startYCoord -= (int)_speedBoat.Step;
+ }
+ break;
+ // вправо
+ case DirectionType.Right:
+ if (startXCoord + _speedBoat.Step + widthBoat < screenWidth)
+ {
+ startXCoord += (int)_speedBoat.Step;
+ }
+ break;
+ //вниз
+ case DirectionType.Down:
+ if (startYCoord + _speedBoat.Step + heightBoat < screenHeight)
+ {
+ startYCoord += (int)_speedBoat.Step;
+ }
+ break;
+ }
+ }
+
+ ///
+ /// Прорисовка объекта
+ ///
+ public void DrawTransport(Graphics g)
+ {
+ if (_speedBoat == null)
+ {
+ return;
+ }
+
+ Pen pen = new(Color.Black);
+ Brush additionalBrush = new SolidBrush(_speedBoat.SecondColor);
+ Brush mainBrush = new SolidBrush(_speedBoat.MainColor);
+
+ #region Координаты переда лодки
+ Point b1 = new Point(startXCoord + 80, startYCoord + 20);
+ Point b2 = new Point(startXCoord + 100, startYCoord + 40);
+ Point b3 = new Point(startXCoord + 80, startYCoord + 60);
+ Point[] pointsBoat = { b1, b2, b3 };
+ #endregion
+
+ #region Координаты защитного стекла
+ Point g1 = new Point(startXCoord + 70, startYCoord + 25);
+ Point g2 = new Point(startXCoord + 80, startYCoord + 20);
+ Point g3 = new Point(startXCoord + 80, startYCoord + 60);
+ Point g4 = new Point(startXCoord + 70, startYCoord + 55);
+ Point[] pointsGlass = { g1, g2, g3, g4 };
+ #endregion
+
+ //основа катера
+ g.DrawRectangle(pen, startXCoord + 20, startYCoord + 20, widthBoat - 40, heightBoat - 40);
+ g.DrawEllipse(pen, startXCoord + 25, startYCoord + 25, widthBoat - 50, heightBoat - 50);
+ g.DrawPolygon(pen, pointsBoat);
+
+ g.FillRectangle(mainBrush, startXCoord + 20, startYCoord + 20, widthBoat - 40, heightBoat - 40);
+ g.FillEllipse(additionalBrush, startXCoord + 25, startYCoord + 25, widthBoat - 50, heightBoat - 50);
+ g.FillPolygon(mainBrush, pointsBoat);
+
+
+ //мотор
+ if (_speedBoat.isMotor)
+ {
+ g.DrawRectangle(pen, startXCoord + 10, startYCoord + 30, widthBoat - 90, heightBoat - 60);
+
+ g.FillRectangle(additionalBrush, startXCoord + 10, startYCoord + 30, widthBoat - 90, heightBoat - 60);
+ }
+
+ //защитное стекло
+ if (_speedBoat.isProtectedGlass)
+ {
+ g.DrawPolygon(pen, pointsGlass);
+
+ g.FillPolygon(new SolidBrush(Color.Aqua), pointsGlass);
+ }
+ }
+ }
+}
diff --git a/speed_Boat/speed_Boat/resources/DOWN.png b/speed_Boat/speed_Boat/resources/DOWN.png
new file mode 100644
index 0000000..31e49e8
Binary files /dev/null and b/speed_Boat/speed_Boat/resources/DOWN.png differ
diff --git a/speed_Boat/speed_Boat/resources/LEFT.png b/speed_Boat/speed_Boat/resources/LEFT.png
new file mode 100644
index 0000000..6917bf8
Binary files /dev/null and b/speed_Boat/speed_Boat/resources/LEFT.png differ
diff --git a/speed_Boat/speed_Boat/resources/RIGHT.png b/speed_Boat/speed_Boat/resources/RIGHT.png
new file mode 100644
index 0000000..94c3f42
Binary files /dev/null and b/speed_Boat/speed_Boat/resources/RIGHT.png differ
diff --git a/speed_Boat/speed_Boat/resources/UP.png b/speed_Boat/speed_Boat/resources/UP.png
new file mode 100644
index 0000000..e23edf8
Binary files /dev/null and b/speed_Boat/speed_Boat/resources/UP.png differ
diff --git a/speed_Boat/speed_Boat/speed_Boat.csproj b/speed_Boat/speed_Boat/speed_Boat.csproj
new file mode 100644
index 0000000..2faea65
--- /dev/null
+++ b/speed_Boat/speed_Boat/speed_Boat.csproj
@@ -0,0 +1,24 @@
+
+
+
+ WinExe
+ net5.0-windows
+ true
+
+
+
+
+ True
+ True
+ Resources.resx
+
+
+
+
+
+ ResXFileCodeGenerator
+ Resources.Designer.cs
+
+
+
+
\ No newline at end of file