Конец..?
This commit is contained in:
parent
5795b9c88a
commit
06987670c4
@ -21,7 +21,7 @@ namespace ProjectPlane
|
|||||||
public DrawingWarPlane(int speed, float weight, Color bodyColor, Color dopColor, bool isBomber, bool isFighter, bool superTurbine) :
|
public DrawingWarPlane(int speed, float weight, Color bodyColor, Color dopColor, bool isBomber, bool isFighter, bool superTurbine) :
|
||||||
base(speed, weight, bodyColor, 110, 60)
|
base(speed, weight, bodyColor, 110, 60)
|
||||||
{
|
{
|
||||||
Plane = new EntityWarPlane(speed, weight, bodyColor, dopColor, isBomber, isFighter, superTurbine);
|
Plane = new EntityWarPlane(speed, weight, bodyColor, dopColor, isFighter, superTurbine);
|
||||||
}
|
}
|
||||||
public override void DrawTransport(Graphics g)
|
public override void DrawTransport(Graphics g)
|
||||||
{
|
{
|
||||||
@ -52,16 +52,7 @@ namespace ProjectPlane
|
|||||||
_startPosX -= 10;
|
_startPosX -= 10;
|
||||||
_startPosY -= 5;
|
_startPosY -= 5;
|
||||||
|
|
||||||
if (warplane.IsBomber)
|
if (warplane.extraCell)
|
||||||
{
|
|
||||||
g.FillEllipse(brBlack, _startPosX + 88, _startPosY + 20, 4, 4);
|
|
||||||
g.FillRectangle(Brush, _startPosX + 60, _startPosY + 20, 30, 12);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (warplane.IsFighter)
|
|
||||||
{
|
{
|
||||||
Point[] Nose = new Point[4];
|
Point[] Nose = new Point[4];
|
||||||
Nose[0].X = Convert.ToInt32(_startPosX + 118); Nose[0].Y = Convert.ToInt32(_startPosY + 22);
|
Nose[0].X = Convert.ToInt32(_startPosX + 118); Nose[0].Y = Convert.ToInt32(_startPosY + 22);
|
||||||
|
@ -15,14 +15,11 @@ namespace ProjectPlane
|
|||||||
/// Дополнительный цвет
|
/// Дополнительный цвет
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Color DopColor { get; private set; }
|
public Color DopColor { get; private set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Бомбандировщик ли
|
/// доп отсек
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsBomber { get; private set; }
|
public bool extraCell { get; private set; }
|
||||||
/// <summary>
|
|
||||||
/// Истребитель ли
|
|
||||||
/// </summary>
|
|
||||||
public bool IsFighter { get; private set; }
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// наличие супертурбины
|
/// наличие супертурбины
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,18 +29,16 @@ namespace ProjectPlane
|
|||||||
/// Инициализация свойств
|
/// Инициализация свойств
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="speed">Скорость</param>
|
/// <param name="speed">Скорость</param>
|
||||||
/// <param name="weight">Вес автомобиля</param>
|
/// <param name="weight">Вес самолета</param>
|
||||||
/// <param name="bodyColor">Цвет кузова</param>
|
/// <param name="bodyColor">Цвет корпуса</param>
|
||||||
/// <param name="dopColor">Дополнительный цвет</param>
|
/// <param name="dopColor">Дополнительный цвет</param>
|
||||||
/// <param name="bodyKit">Признак наличия обвеса</param>
|
/// <param name="cell">Признак наличия доп остсека>
|
||||||
/// <param name="wing">Признак наличия антикрыла</param>
|
|
||||||
///
|
///
|
||||||
public EntityWarPlane(int speed, float weight, Color bodyColor, Color dopColor, bool bodyKit, bool wing, bool superturbine) :
|
public EntityWarPlane(int speed, float weight, Color bodyColor, Color dopColor, bool cell, bool superturbine) :
|
||||||
base(speed, weight, bodyColor)
|
base(speed, weight, bodyColor)
|
||||||
{
|
{
|
||||||
DopColor = dopColor;
|
DopColor = dopColor;
|
||||||
IsBomber = bodyKit;
|
extraCell = cell;
|
||||||
IsFighter = wing;
|
|
||||||
SuperTurbine = superturbine;
|
SuperTurbine = superturbine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
5
ProjectPlane/ProjectPlane/FormMap.Designer.cs
generated
5
ProjectPlane/ProjectPlane/FormMap.Designer.cs
generated
@ -108,6 +108,7 @@
|
|||||||
this.pictureBoxPlane.Size = new System.Drawing.Size(800, 450);
|
this.pictureBoxPlane.Size = new System.Drawing.Size(800, 450);
|
||||||
this.pictureBoxPlane.TabIndex = 5;
|
this.pictureBoxPlane.TabIndex = 5;
|
||||||
this.pictureBoxPlane.TabStop = false;
|
this.pictureBoxPlane.TabStop = false;
|
||||||
|
|
||||||
//
|
//
|
||||||
// statusStrip1
|
// statusStrip1
|
||||||
//
|
//
|
||||||
@ -155,10 +156,14 @@
|
|||||||
//
|
//
|
||||||
this.comboMapSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
this.comboMapSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||||
this.comboMapSelector.FormattingEnabled = true;
|
this.comboMapSelector.FormattingEnabled = true;
|
||||||
|
this.comboMapSelector.Items.AddRange(new object[] {
|
||||||
|
"Simple Map",
|
||||||
|
"Sky Map"});
|
||||||
this.comboMapSelector.Location = new System.Drawing.Point(12, 12);
|
this.comboMapSelector.Location = new System.Drawing.Point(12, 12);
|
||||||
this.comboMapSelector.Name = "comboMapSelector";
|
this.comboMapSelector.Name = "comboMapSelector";
|
||||||
this.comboMapSelector.Size = new System.Drawing.Size(121, 23);
|
this.comboMapSelector.Size = new System.Drawing.Size(121, 23);
|
||||||
this.comboMapSelector.TabIndex = 11;
|
this.comboMapSelector.TabIndex = 11;
|
||||||
|
this.comboMapSelector.SelectedIndexChanged += new System.EventHandler(this.comboMapSelector_SelectedIndexChanged);
|
||||||
//
|
//
|
||||||
// FormMap
|
// FormMap
|
||||||
//
|
//
|
||||||
|
@ -18,6 +18,19 @@ namespace ProjectPlane
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
_abstractMap = new SimpleMap();
|
_abstractMap = new SimpleMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void comboMapSelector_SelectedIndexChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
switch (comboMapSelector.SelectedIndex)
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
_abstractMap = new SimpleMap();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
_abstractMap = new SkyMap();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
/// <param name="plane"></param>
|
/// <param name="plane"></param>
|
||||||
private void SetData(DrawingPlane plane)
|
private void SetData(DrawingPlane plane)
|
||||||
{
|
{
|
||||||
@ -78,7 +91,7 @@ namespace ProjectPlane
|
|||||||
SetData(_plane);
|
SetData(_plane);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
57
ProjectPlane/ProjectPlane/SkyMap.cs
Normal file
57
ProjectPlane/ProjectPlane/SkyMap.cs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace ProjectPlane
|
||||||
|
{
|
||||||
|
internal class SkyMap : AbstractMap
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Цвет участка закрытого
|
||||||
|
/// </summary>
|
||||||
|
private readonly Brush barrierColor = new SolidBrush(Color.Black);
|
||||||
|
/// <summary>
|
||||||
|
/// Цвет участка открытого
|
||||||
|
/// </summary>
|
||||||
|
private readonly Brush skyColor = new SolidBrush(Color.AliceBlue);
|
||||||
|
|
||||||
|
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||||
|
{
|
||||||
|
Point[] Triangle = new Point[3];
|
||||||
|
Triangle[0].X = i * (int)_size_x; Triangle[0].Y = j * (int)_size_y;
|
||||||
|
Triangle[1].X = i * (int)_size_x + 8; Triangle[1].Y = j * (int)_size_y - 5;
|
||||||
|
Triangle[2].X = i * (int)_size_x + 8; Triangle[2].Y = j * (int)_size_y + 5;
|
||||||
|
g.FillPolygon(barrierColor, Triangle);
|
||||||
|
}
|
||||||
|
protected override void DrawRoadPart(Graphics g, int i, int j)
|
||||||
|
{
|
||||||
|
g.FillRectangle(skyColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
|
||||||
|
}
|
||||||
|
protected override void GenerateMap()
|
||||||
|
{
|
||||||
|
_map = new int[100, 100];
|
||||||
|
_size_x = (float)_width / _map.GetLength(0);
|
||||||
|
_size_y = (float)_height / _map.GetLength(1);
|
||||||
|
int counter = 0;
|
||||||
|
for (int i = 0; i < _map.GetLength(0); ++i)
|
||||||
|
{
|
||||||
|
for (int j = 0; j < _map.GetLength(1); ++j)
|
||||||
|
{
|
||||||
|
_map[i, j] = _freeRoad;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (counter < 30)
|
||||||
|
{
|
||||||
|
int x = _random.Next(0, 100);
|
||||||
|
int y = _random.Next(0, 100);
|
||||||
|
if (_map[x, y] == _freeRoad)
|
||||||
|
{
|
||||||
|
_map[x, y] = _barrier;
|
||||||
|
counter++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user