Compare commits
2 Commits
83c1b990fe
...
c25cdbe283
Author | SHA1 | Date | |
---|---|---|---|
c25cdbe283 | |||
9fb556bc07 |
@ -14,14 +14,14 @@ namespace ProjectArtilleryUnit.Drawnings
|
|||||||
/// <param name="weight">Вес</param>
|
/// <param name="weight">Вес</param>
|
||||||
/// <param name="bodyColor">Основной цвет</param>
|
/// <param name="bodyColor">Основной цвет</param>
|
||||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||||
/// <param name="helicopterArea">Признак наличия вертолетной площадки</param>
|
/// <param name="muzzle">Признак наличия дула</param>
|
||||||
/// <param name="gun">Признак наличия шлюпок</param>
|
/// <param name="gun">Признак наличия ракетной установки</param>
|
||||||
/// <param name="luke">Признак наличия пушки</param>
|
/// <param name="luke">Признак наличия люка</param>
|
||||||
|
|
||||||
public DrawningMilitaryArtilleryUnit(int speed, double weight, Color bodyColor, Color additionalColor, bool helicopterArea, bool gun, bool luke)
|
public DrawningMilitaryArtilleryUnit(int speed, double weight, Color bodyColor, Color additionalColor, bool muzzle, bool gun, bool luke)
|
||||||
: base(150, 50)
|
: base(150, 50)
|
||||||
{
|
{
|
||||||
EntityArtilleryUnit = new EntityMilitaryArtilleryUnit(speed, weight, bodyColor, additionalColor, helicopterArea, gun, luke);
|
EntityArtilleryUnit = new EntityMilitaryArtilleryUnit(speed, weight, bodyColor, additionalColor, muzzle, gun, luke);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void DrawTransport(Graphics g)
|
public override void DrawTransport(Graphics g)
|
||||||
|
@ -10,36 +10,36 @@ namespace ProjectArtilleryUnit.MovementStrategy
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Поле-объект класса DrawningArtilleryUnit или его наследника
|
/// Поле-объект класса DrawningArtilleryUnit или его наследника
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly DrawningArtilleryUnit? _cruiser = null;
|
private readonly DrawningArtilleryUnit? _artilleryUnit = null;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конструктор
|
/// Конструктор
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="cruiser">Объект класса DrawningArtilleryUnit</param>
|
/// <param name="artilleryUnit">Объект класса DrawningArtilleryUnit</param>
|
||||||
public MoveableArtilleryUnit(DrawningArtilleryUnit cruiser)
|
public MoveableArtilleryUnit(DrawningArtilleryUnit artilleryUnit)
|
||||||
{
|
{
|
||||||
_cruiser = cruiser;
|
_artilleryUnit = artilleryUnit;
|
||||||
}
|
}
|
||||||
public ObjectParameters? GetObjectPosition
|
public ObjectParameters? GetObjectPosition
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (_cruiser == null || _cruiser.EntityArtilleryUnit == null ||
|
if (_artilleryUnit == null || _artilleryUnit.EntityArtilleryUnit == null ||
|
||||||
!_cruiser.GetPosX.HasValue || !_cruiser.GetPosY.HasValue)
|
!_artilleryUnit.GetPosX.HasValue || !_artilleryUnit.GetPosY.HasValue)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return new ObjectParameters(_cruiser.GetPosX.Value,
|
return new ObjectParameters(_artilleryUnit.GetPosX.Value,
|
||||||
_cruiser.GetPosY.Value, _cruiser.GetWidth, _cruiser.GetHeight);
|
_artilleryUnit.GetPosY.Value, _artilleryUnit.GetWidth, _artilleryUnit.GetHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public int GetStep => (int)(_cruiser?.EntityArtilleryUnit?.Step ?? 0);
|
public int GetStep => (int)(_artilleryUnit?.EntityArtilleryUnit?.Step ?? 0);
|
||||||
public bool TryMoveObject(MovementDirection direction)
|
public bool TryMoveObject(MovementDirection direction)
|
||||||
{
|
{
|
||||||
if (_cruiser == null || _cruiser.EntityArtilleryUnit == null)
|
if (_artilleryUnit == null || _artilleryUnit.EntityArtilleryUnit == null)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return _cruiser.MoveTransport(GetDirectionType(direction));
|
return _artilleryUnit.MoveTransport(GetDirectionType(direction));
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Конвертация из MovementDirection в DirectionType
|
/// Конвертация из MovementDirection в DirectionType
|
||||||
|
Loading…
Reference in New Issue
Block a user