Compare commits
6 Commits
63b5bc994b
...
b69d10b872
Author | SHA1 | Date | |
---|---|---|---|
b69d10b872 | |||
03c6fa946c | |||
297eb3a2ab | |||
e6028b4a0e | |||
12ba5a0148 | |||
23663c6c47 |
12
AirBomber/AirBomber/AbstractStrategy.cs
Normal file
12
AirBomber/AirBomber/AbstractStrategy.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class AbstractStrategy
|
||||
{
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AirBomber;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
@ -16,9 +17,8 @@ namespace AirBomber
|
||||
/// <param name="weight">Вес</param>
|
||||
/// <param name="bodyColor">Основной цвет</param>
|
||||
/// <param name="additionalColor">Дополнительный цвет</param>
|
||||
/// <param name="bodyKit">Признак наличия обвеса</param>
|
||||
/// <param name="wing">Признак наличия антикрыла</param>
|
||||
/// <param name="sportLine">Признак наличия гоночной полосы</param>
|
||||
/// <param name="bombs">Признак наличия обвеса</param>
|
||||
/// <param name="fuelTanks">Признак наличия антикрыла</param>
|
||||
/// <param name="width">Ширина картинки</param>
|
||||
/// <param name="height">Высота картинки</param>
|
||||
public DrawningAirBomber(int speed, double weight, Color bodyColor, Color
|
||||
@ -28,17 +28,18 @@ namespace AirBomber
|
||||
{
|
||||
if (EntityAirPlane != null)
|
||||
{
|
||||
EntityAirPlane = new EntityAirBomber(speed, weight, bodyColor, additionalColor, bombs, fuelTanks);
|
||||
EntityAirPlane = new EntityAirBomber(speed, weight, bodyColor, additionalColor, bombs, bombsColor, fuelTanks);
|
||||
}
|
||||
}
|
||||
public override void DrawPlane(Graphics g)
|
||||
{
|
||||
if (EntityAirPlane is not EntityAirPlane airBomber)
|
||||
if (EntityAirPlane is not EntityAirBomber airBomber)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Pen pen = new(Color.Black);
|
||||
Brush additionalBrush = new SolidBrush(airBomber.AdditionalColor);
|
||||
Brush bombsColor = new SolidBrush(airBomber.BombsColor);
|
||||
base.DrawPlane(g);
|
||||
// обвесы
|
||||
if (airBomber.Bombs)
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AirBomber;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
@ -214,6 +215,75 @@ namespace AirBomber
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Координата X объекта
|
||||
/// </summary>
|
||||
public int GetPosX => _startPosX;
|
||||
/// <summary>
|
||||
/// Координата Y объекта
|
||||
/// </summary>
|
||||
public int GetPosY => _startPosY;
|
||||
/// <summary>
|
||||
/// Ширина объекта
|
||||
/// </summary>
|
||||
public int GetWidth => _airPlaneWidth;
|
||||
/// <summary>
|
||||
/// Высота объекта
|
||||
/// </summary>
|
||||
public int GetHeight => _airPlaneHeight;
|
||||
/// <summary>
|
||||
/// Проверка, что объект может переместится по указанному направлению
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
/// <returns>true - можно переместится по указанному направлению</returns>
|
||||
public bool CanMove(DirectionType direction)
|
||||
{
|
||||
if (EntityAirPlane == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return direction switch
|
||||
{
|
||||
//влево
|
||||
DirectionType.Left => _startPosX - EntityAirPlane.Step > 0,
|
||||
//вверх
|
||||
DirectionType.Up => _startPosY - EntityAirPlane.Step > 0,
|
||||
// вправо
|
||||
DirectionType.Right => false,// TODO: Продумать логику
|
||||
//вниз
|
||||
DirectionType.Down => false,// TODO: Продумать логику
|
||||
_ => false,
|
||||
};
|
||||
}
|
||||
/// <summary>
|
||||
/// Изменение направления перемещения
|
||||
/// </summary>
|
||||
/// <param name="direction">Направление</param>
|
||||
public void MovePlane(DirectionType direction)
|
||||
{
|
||||
if (!CanMove(direction) || EntityAirPlane == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (direction)
|
||||
{
|
||||
//влево
|
||||
case DirectionType.Left:
|
||||
_startPosX -= (int)EntityAirPlane.Step;
|
||||
break;
|
||||
//вверх
|
||||
case DirectionType.Up:
|
||||
_startPosY -= (int)EntityAirPlane.Step;
|
||||
break;
|
||||
// вправо
|
||||
case DirectionType.Right:
|
||||
_startPosX += (int)EntityAirPlane.Step;
|
||||
break;
|
||||
//вниз
|
||||
case DirectionType.Down:
|
||||
_startPosY += (int)EntityAirPlane.Step;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
12
AirBomber/AirBomber/DrawningObjectAirPlane.cs
Normal file
12
AirBomber/AirBomber/DrawningObjectAirPlane.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class DrawningObjectAirPlane
|
||||
{
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AirBomber;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
|
@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using AirBomber;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
|
12
AirBomber/AirBomber/IMoveableObject.cs
Normal file
12
AirBomber/AirBomber/IMoveableObject.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal interface IMoveableObject
|
||||
{
|
||||
}
|
||||
}
|
12
AirBomber/AirBomber/ObjectParameters.cs
Normal file
12
AirBomber/AirBomber/ObjectParameters.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class ObjectParameters
|
||||
{
|
||||
}
|
||||
}
|
12
AirBomber/AirBomber/Status.cs
Normal file
12
AirBomber/AirBomber/Status.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace AirBomber
|
||||
{
|
||||
internal class Status
|
||||
{
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user