Внесены изменения в именах

This commit is contained in:
ikswi 2024-04-01 01:18:15 +04:00
parent 1f06635803
commit ab47d675ec
8 changed files with 30 additions and 28 deletions

View File

@ -55,11 +55,11 @@ public abstract class AbstractCompany
/// Перегрузка оператора сложения для класса
/// </summary>
/// <param name="company">Компания</param>
/// <param name="plane">Добавляемый объект</param>
/// <param name="militaryAircraft">Добавляемый объект</param>
/// <returns></returns>
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);
}
/// <summary>

View File

@ -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);

View File

@ -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();
}

View File

@ -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)

View File

@ -28,7 +28,7 @@
</data>
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

View File

@ -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()

View File

@ -5,44 +5,44 @@ namespace ProjectAirFighter.MovementStrategy;
/// <summary>
/// Класс-реализация IMoveableObject с использованием DrawningCar
/// </summary>
public class MoveableAir : IMoveableObject
public class MoveableMilitaryAircraft : IMoveableObject
{
/// <summary>
/// Поле-объект класса DrawningCar или его наследника
/// Поле-объект класса DrawningMilitaryAircraft или его наследника
/// </summary>
private readonly DrawningMilitaryAircraft? _plane = null;
private readonly DrawningMilitaryAircraft? _militaryAircraft = null;
/// <summary>
/// Конструктор
/// </summary>
/// <param name="car">Объект класса DrawningCar</param>
public MoveableAir(DrawningMilitaryAircraft plane)
/// <param name="militaryAircraft">Объект класса DrawningMilitaryAircraft</param>
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));
}
/// <summary>

View File

@ -28,7 +28,7 @@
</data>
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