Внесены изменения в именах
This commit is contained in:
parent
1f06635803
commit
ab47d675ec
@ -55,11 +55,11 @@ public abstract class AbstractCompany
|
|||||||
/// Перегрузка оператора сложения для класса
|
/// Перегрузка оператора сложения для класса
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="company">Компания</param>
|
/// <param name="company">Компания</param>
|
||||||
/// <param name="plane">Добавляемый объект</param>
|
/// <param name="militaryAircraft">Добавляемый объект</param>
|
||||||
/// <returns></returns>
|
/// <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>
|
/// <summary>
|
||||||
|
@ -24,17 +24,17 @@ public class DrawningAirFighter : DrawningMilitaryAircraft
|
|||||||
|
|
||||||
public override void DrawTransport(Graphics g)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Pen pen = new(Color.Black);
|
Pen pen = new(Color.Black);
|
||||||
Brush additionalBrush = new SolidBrush(planeFighter.AdditionalColor);
|
Brush additionalBrush = new SolidBrush(militaryAircraftFighter.AdditionalColor);
|
||||||
|
|
||||||
base.DrawTransport(g);
|
base.DrawTransport(g);
|
||||||
|
|
||||||
if (planeFighter.Wings)
|
if (militaryAircraftFighter.Wings)
|
||||||
{
|
{
|
||||||
Point wings1 = new Point(_startPosX.Value + 45, _startPosY.Value + 30);
|
Point wings1 = new Point(_startPosX.Value + 45, _startPosY.Value + 30);
|
||||||
Point wings2 = new Point(_startPosX.Value + 45, _startPosY.Value + 15);
|
Point wings2 = new Point(_startPosX.Value + 45, _startPosY.Value + 15);
|
||||||
@ -53,7 +53,7 @@ public class DrawningAirFighter : DrawningMilitaryAircraft
|
|||||||
g.DrawPolygon(pen, DownWing);
|
g.DrawPolygon(pen, DownWing);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (planeFighter.Rockets)
|
if (militaryAircraftFighter.Rockets)
|
||||||
{
|
{
|
||||||
Point rocket1 = new Point(_startPosX.Value + 40, _startPosY.Value + 5);
|
Point rocket1 = new Point(_startPosX.Value + 40, _startPosY.Value + 5);
|
||||||
Point rocket2 = new Point(_startPosX.Value + 15, _startPosY.Value + 5);
|
Point rocket2 = new Point(_startPosX.Value + 15, _startPosY.Value + 5);
|
||||||
|
@ -145,11 +145,11 @@ public partial class FormAirCollection : Form
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawningMilitaryAircraft? plane = null;
|
DrawningMilitaryAircraft? militaryAircraft = null;
|
||||||
int counter = 100;
|
int counter = 100;
|
||||||
while (plane == null)
|
while (militaryAircraft == null)
|
||||||
{
|
{
|
||||||
plane = _company.GetRandomObject();
|
militaryAircraft = _company.GetRandomObject();
|
||||||
counter--;
|
counter--;
|
||||||
if (counter <= 0)
|
if (counter <= 0)
|
||||||
{
|
{
|
||||||
@ -157,14 +157,14 @@ public partial class FormAirCollection : Form
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (plane == null)
|
if (militaryAircraft == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
FormAirFighter form = new()
|
FormAirFighter form = new()
|
||||||
{
|
{
|
||||||
SetAir = plane
|
SetAir = militaryAircraft
|
||||||
};
|
};
|
||||||
form.ShowDialog();
|
form.ShowDialog();
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ public partial class FormAirFighter : Form
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_strategy.SetData(new MoveableAir(_drawningMilitaryAircraft), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
_strategy.SetData(new MoveableMilitaryAircraft(_drawningMilitaryAircraft), pictureBoxAirFighter.Width, pictureBoxAirFighter.Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_strategy == null)
|
if (_strategy == null)
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
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
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
@ -13,8 +13,10 @@ public class MoveToCenter : AbstractStrategy
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 && objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
return objParams.ObjectMiddleHorizontal - GetStep() <= FieldWidth / 2 &&
|
||||||
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 && objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
objParams.ObjectMiddleHorizontal + GetStep() >= FieldWidth / 2 &&
|
||||||
|
objParams.ObjectMiddleVertical - GetStep() <= FieldHeight / 2 &&
|
||||||
|
objParams.ObjectMiddleVertical + GetStep() >= FieldHeight / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void MoveToTarget()
|
protected override void MoveToTarget()
|
||||||
|
@ -5,44 +5,44 @@ namespace ProjectAirFighter.MovementStrategy;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Класс-реализация IMoveableObject с использованием DrawningCar
|
/// Класс-реализация IMoveableObject с использованием DrawningCar
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class MoveableAir : IMoveableObject
|
public class MoveableMilitaryAircraft : IMoveableObject
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Поле-объект класса DrawningCar или его наследника
|
/// Поле-объект класса DrawningMilitaryAircraft или его наследника
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly DrawningMilitaryAircraft? _plane = null;
|
private readonly DrawningMilitaryAircraft? _militaryAircraft = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="car">Объект класса DrawningCar</param>
|
/// <param name="militaryAircraft">Объект класса DrawningMilitaryAircraft</param>
|
||||||
public MoveableAir(DrawningMilitaryAircraft plane)
|
public MoveableMilitaryAircraft(DrawningMilitaryAircraft militaryAircraft)
|
||||||
{
|
{
|
||||||
_plane = plane;
|
_militaryAircraft = militaryAircraft;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ObjectParameters? GetObjectPosition
|
public ObjectParameters? GetObjectPosition
|
||||||
{
|
{
|
||||||
get
|
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 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)
|
public bool TryMoveObject(MovementDirection direction)
|
||||||
{
|
{
|
||||||
if (_plane == null || _plane.EntityMilitaryAircraft == null)
|
if (_militaryAircraft == null || _militaryAircraft.EntityMilitaryAircraft == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return _plane.MoveTransport(GetDirectionType(direction));
|
return _militaryAircraft.MoveTransport(GetDirectionType(direction));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
@ -28,7 +28,7 @@
|
|||||||
</data>
|
</data>
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
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
|
Each data row contains a name, and value. The row also contains a
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
type or mimetype. Type corresponds to a .NET class that support
|
||||||
|
Loading…
Reference in New Issue
Block a user