diff --git a/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs b/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs index c74f20e..2fce08a 100644 --- a/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs +++ b/AirFighter/AirFighter/CollectionGenericObjects/AbstractCompany.cs @@ -55,11 +55,11 @@ public abstract class AbstractCompany /// Перегрузка оператора сложения для класса /// /// Компания - /// Добавляемый объект + /// Добавляемый объект /// - public static int operator +(AbstractCompany company, DrawningMilitaryAircraft plane) + public static int operator +(AbstractCompany company, DrawningMilitaryAircraft militaryAircraft) { - return company._collection.Insert(plane); + return company._collection.Insert(militaryAircraft); } /// diff --git a/AirFighter/AirFighter/Drawnings/DrawningAirFighter.cs b/AirFighter/AirFighter/Drawnings/DrawningAirFighter.cs index 9b403b0..7dab3a2 100644 --- a/AirFighter/AirFighter/Drawnings/DrawningAirFighter.cs +++ b/AirFighter/AirFighter/Drawnings/DrawningAirFighter.cs @@ -24,17 +24,17 @@ public class DrawningAirFighter : DrawningMilitaryAircraft public override void DrawTransport(Graphics g) { - if (EntityMilitaryAircraft == null || EntityMilitaryAircraft is not EntityAirFighter planeFighter || !_startPosX.HasValue || !_startPosY.HasValue) + if (EntityMilitaryAircraft == null || EntityMilitaryAircraft is not EntityAirFighter militaryAircraftFighter || !_startPosX.HasValue || !_startPosY.HasValue) { return; } Pen pen = new(Color.Black); - Brush additionalBrush = new SolidBrush(planeFighter.AdditionalColor); + Brush additionalBrush = new SolidBrush(militaryAircraftFighter.AdditionalColor); base.DrawTransport(g); - if (planeFighter.Wings) + if (militaryAircraftFighter.Wings) { Point wings1 = new Point(_startPosX.Value + 45, _startPosY.Value + 30); Point wings2 = new Point(_startPosX.Value + 45, _startPosY.Value + 15); @@ -53,7 +53,7 @@ public class DrawningAirFighter : DrawningMilitaryAircraft g.DrawPolygon(pen, DownWing); } - if (planeFighter.Rockets) + if (militaryAircraftFighter.Rockets) { Point rocket1 = new Point(_startPosX.Value + 40, _startPosY.Value + 5); Point rocket2 = new Point(_startPosX.Value + 15, _startPosY.Value + 5); diff --git a/AirFighter/AirFighter/FormAirCollection.cs b/AirFighter/AirFighter/FormAirCollection.cs index c719ec7..5ad4928 100644 --- a/AirFighter/AirFighter/FormAirCollection.cs +++ b/AirFighter/AirFighter/FormAirCollection.cs @@ -145,11 +145,11 @@ public partial class FormAirCollection : Form return; } - DrawningMilitaryAircraft? plane = null; + DrawningMilitaryAircraft? militaryAircraft = null; int counter = 100; - while (plane == null) + while (militaryAircraft == null) { - plane = _company.GetRandomObject(); + militaryAircraft = _company.GetRandomObject(); counter--; if (counter <= 0) { @@ -157,14 +157,14 @@ public partial class FormAirCollection : Form } } - if (plane == null) + if (militaryAircraft == null) { return; } FormAirFighter form = new() { - SetAir = plane + SetAir = militaryAircraft }; form.ShowDialog(); } diff --git a/AirFighter/AirFighter/FormAirFighter.cs b/AirFighter/AirFighter/FormAirFighter.cs index edbb617..c6a3be9 100644 --- a/AirFighter/AirFighter/FormAirFighter.cs +++ b/AirFighter/AirFighter/FormAirFighter.cs @@ -90,7 +90,7 @@ public partial class FormAirFighter : Form { return; } - _strategy.SetData(new MoveableAir(_drawningMilitaryAircraft), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); + _strategy.SetData(new MoveableMilitaryAircraft(_drawningMilitaryAircraft), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height); } if (_strategy == null) diff --git a/AirFighter/AirFighter/FormAirFighter.resx b/AirFighter/AirFighter/FormAirFighter.resx index 39e9e6f..b5123c1 100644 --- a/AirFighter/AirFighter/FormAirFighter.resx +++ b/AirFighter/AirFighter/FormAirFighter.resx @@ -28,7 +28,7 @@ There are any number of "resheader" rows that contain simple - name/value pplanes. + name/value pmilitaryAircrafts. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support diff --git a/AirFighter/AirFighter/MovementStrategy/MoveToCenter.cs b/AirFighter/AirFighter/MovementStrategy/MoveToCenter.cs index b7dd88e..94c4717 100644 --- a/AirFighter/AirFighter/MovementStrategy/MoveToCenter.cs +++ b/AirFighter/AirFighter/MovementStrategy/MoveToCenter.cs @@ -13,8 +13,10 @@ public class MoveToCenter : AbstractStrategy return false; } - return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && - objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; + return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && + objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 && + objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && + objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2; } protected override void MoveToTarget() diff --git a/AirFighter/AirFighter/MovementStrategy/MoveableAir.cs b/AirFighter/AirFighter/MovementStrategy/MoveableMilitaryAircraft.cs similarity index 53% rename from AirFighter/AirFighter/MovementStrategy/MoveableAir.cs rename to AirFighter/AirFighter/MovementStrategy/MoveableMilitaryAircraft.cs index efa7dbc..35d2781 100644 --- a/AirFighter/AirFighter/MovementStrategy/MoveableAir.cs +++ b/AirFighter/AirFighter/MovementStrategy/MoveableMilitaryAircraft.cs @@ -5,44 +5,44 @@ namespace ProjectAirFighter.MovementStrategy; /// /// Класс-реализация IMoveableObject с использованием DrawningCar /// -public class MoveableAir : IMoveableObject +public class MoveableMilitaryAircraft : IMoveableObject { /// - /// Поле-объект класса DrawningCar или его наследника + /// Поле-объект класса DrawningMilitaryAircraft или его наследника /// - private readonly DrawningMilitaryAircraft? _plane = null; + private readonly DrawningMilitaryAircraft? _militaryAircraft = null; /// /// Конструктор /// - /// Объект класса DrawningCar - public MoveableAir(DrawningMilitaryAircraft plane) + /// Объект класса DrawningMilitaryAircraft + public MoveableMilitaryAircraft(DrawningMilitaryAircraft militaryAircraft) { - _plane = plane; + _militaryAircraft = militaryAircraft; } public ObjectParameters? GetObjectPosition { get { - if (_plane == null || _plane.EntityMilitaryAircraft == null || !_plane.GetPosX.HasValue || !_plane.GetPosY.HasValue) + if (_militaryAircraft == null || _militaryAircraft.EntityMilitaryAircraft == null || !_militaryAircraft.GetPosX.HasValue || !_militaryAircraft.GetPosY.HasValue) { return null; } - return new ObjectParameters(_plane.GetPosX.Value, _plane.GetPosY.Value, _plane.GetWidth, _plane.GetHeight); + return new ObjectParameters(_militaryAircraft.GetPosX.Value, _militaryAircraft.GetPosY.Value, _militaryAircraft.GetWidth, _militaryAircraft.GetHeight); } } - public int GetStep => (int)(_plane?.EntityMilitaryAircraft?.Step ?? 0); + public int GetStep => (int)(_militaryAircraft?.EntityMilitaryAircraft?.Step ?? 0); public bool TryMoveObject(MovementDirection direction) { - if (_plane == null || _plane.EntityMilitaryAircraft == null) + if (_militaryAircraft == null || _militaryAircraft.EntityMilitaryAircraft == null) { return false; } - return _plane.MoveTransport(GetDirectionType(direction)); + return _militaryAircraft.MoveTransport(GetDirectionType(direction)); } /// diff --git a/AirFighter/AirFighter/Properties/Resources.resx b/AirFighter/AirFighter/Properties/Resources.resx index 07a09cc..5f05973 100644 --- a/AirFighter/AirFighter/Properties/Resources.resx +++ b/AirFighter/AirFighter/Properties/Resources.resx @@ -28,7 +28,7 @@ There are any number of "resheader" rows that contain simple - name/value pplanes. + name/value pmilitaryAircrafts. Each data row contains a name, and value. The row also contains a type or mimetype. Type corresponds to a .NET class that support