Защитил
This commit is contained in:
parent
1333c85ae3
commit
4b3b345b66
@ -30,15 +30,63 @@ namespace Traktor
|
||||
}
|
||||
return DrawMapWithObject();
|
||||
}
|
||||
|
||||
public bool CheckAround(float Left, float Right, float Top, float Bottom)
|
||||
{
|
||||
int startX = (int)(Left / _size_x);
|
||||
int startY = (int)(Right / _size_y);
|
||||
int endX = (int)(Top / _size_x);
|
||||
if (endX > 100)
|
||||
{
|
||||
endX = 100;
|
||||
}
|
||||
int endY = (int)(Bottom / _size_y);
|
||||
if (endY > 100)
|
||||
{
|
||||
endY = 100;
|
||||
}
|
||||
|
||||
for (int i = startX; i < endX; i++)
|
||||
{
|
||||
for (int j = startY; j < endY; j++)
|
||||
{
|
||||
if (_map[i, j] == _barrier)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Bitmap MoveObject(Direction direction)
|
||||
{
|
||||
// TODO проверка, что объект может переместится в требуемом направлении
|
||||
if (true)
|
||||
_drawningObject.MoveObject(direction);
|
||||
(float Left, float Right, float Top, float Bottom) = _drawningObject.GetCurrentPosition();
|
||||
|
||||
if (CheckAround(Left, Right, Top, Bottom))
|
||||
{
|
||||
_drawningObject.MoveObject(direction);
|
||||
_drawningObject.MoveObject(MoveObjectBack(direction));
|
||||
}
|
||||
return DrawMapWithObject();
|
||||
}
|
||||
|
||||
private Direction MoveObjectBack(Direction direction)
|
||||
{
|
||||
switch (direction)
|
||||
{
|
||||
case Direction.Up:
|
||||
return Direction.Down;
|
||||
case Direction.Down:
|
||||
return Direction.Up;
|
||||
case Direction.Left:
|
||||
return Direction.Right;
|
||||
case Direction.Right:
|
||||
return Direction.Left;
|
||||
}
|
||||
return Direction.None;
|
||||
}
|
||||
|
||||
private bool SetObjectOnMap()
|
||||
{
|
||||
if (_drawningObject == null || _map == null)
|
||||
@ -48,9 +96,34 @@ namespace Traktor
|
||||
int x = _random.Next(0, 10);
|
||||
int y = _random.Next(0, 10);
|
||||
_drawningObject.SetObject(x, y, _width, _height);
|
||||
// TODO првоерка, что объект не "накладывается" на закрытые участки
|
||||
return true;
|
||||
(float Left, float Right, float Top, float Bottom) = _drawningObject.GetCurrentPosition();
|
||||
if (!CheckAround(Left, Right, Top, Bottom)) return true;
|
||||
float startX = Left;
|
||||
float startY = Right;
|
||||
float lengthX = Top - Left;
|
||||
float lengthY = Bottom - Right;
|
||||
while (CheckAround(startX, startY, startX + lengthX, startY + lengthY))
|
||||
{
|
||||
bool result;
|
||||
do
|
||||
{
|
||||
result = CheckAround(startX, startY, startX + lengthX, startY + lengthY);
|
||||
if (!result)
|
||||
{
|
||||
_drawningObject.SetObject((int)startX, (int)startY, _width, _height);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
startX += _size_x;
|
||||
}
|
||||
} while (result);
|
||||
startX = x;
|
||||
startY += _size_y;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Bitmap DrawMapWithObject()
|
||||
{
|
||||
Bitmap bmp = new(_width, _height);
|
||||
|
@ -11,7 +11,7 @@ namespace Traktor
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
//Ïðîðèñîâêà ìàøèíû
|
||||
//Ïðîðèñîâêà òðàêòîðà
|
||||
private void Draw()
|
||||
{
|
||||
Bitmap bmp = new(pictureBoxTraktor.Width, pictureBoxTraktor.Height);
|
||||
@ -73,8 +73,7 @@ namespace Traktor
|
||||
Random random = new Random();
|
||||
_Traktor = new MultiTraktorDraw(random.Next(100, 200), random.Next(2500, 5000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
SetData();
|
||||
Draw();
|
||||
}
|
||||
|
51
Traktor/Traktor/FieldMap.cs
Normal file
51
Traktor/Traktor/FieldMap.cs
Normal file
@ -0,0 +1,51 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Traktor
|
||||
{
|
||||
internal class FieldMap : AbstractMap
|
||||
{
|
||||
/// Цвет участка закрытого
|
||||
private readonly Brush barrierColor = new SolidBrush(Color.Yellow);
|
||||
/// Цвет участка открытого
|
||||
private readonly Brush roadColor = new SolidBrush(Color.Green);
|
||||
|
||||
protected override void DrawBarrierPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(barrierColor, i * _size_x, j * _size_y, i * (_size_x + 1), j * (_size_y + 1));
|
||||
}
|
||||
protected override void DrawRoadPart(Graphics g, int i, int j)
|
||||
{
|
||||
g.FillRectangle(roadColor, 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 < 25)
|
||||
{
|
||||
int x = _random.Next(0, 97);
|
||||
int y = _random.Next(0, 97);
|
||||
if (_map[x, y] == _freeRoad)
|
||||
{
|
||||
_map[x, y] = _barrier;
|
||||
_map[x + 2, y] = _barrier;
|
||||
_map[x, y + 2] = _barrier;
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
57
Traktor/Traktor/FormMap.Designer.cs
generated
57
Traktor/Traktor/FormMap.Designer.cs
generated
@ -48,9 +48,8 @@
|
||||
//
|
||||
this.pictureBoxTraktor.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.pictureBoxTraktor.Location = new System.Drawing.Point(0, 0);
|
||||
this.pictureBoxTraktor.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.pictureBoxTraktor.Name = "pictureBoxTraktor";
|
||||
this.pictureBoxTraktor.Size = new System.Drawing.Size(700, 316);
|
||||
this.pictureBoxTraktor.Size = new System.Drawing.Size(800, 425);
|
||||
this.pictureBoxTraktor.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
|
||||
this.pictureBoxTraktor.TabIndex = 0;
|
||||
this.pictureBoxTraktor.TabStop = false;
|
||||
@ -62,37 +61,35 @@
|
||||
this.toolStripStatusLabelSpeed,
|
||||
this.toolStripStatusLabelWeight,
|
||||
this.toolStripStatusLabelBodyColor});
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 316);
|
||||
this.statusStrip.Location = new System.Drawing.Point(0, 425);
|
||||
this.statusStrip.Name = "statusStrip";
|
||||
this.statusStrip.Padding = new System.Windows.Forms.Padding(1, 0, 12, 0);
|
||||
this.statusStrip.Size = new System.Drawing.Size(700, 22);
|
||||
this.statusStrip.Size = new System.Drawing.Size(800, 26);
|
||||
this.statusStrip.TabIndex = 1;
|
||||
//
|
||||
// toolStripStatusLabelSpeed
|
||||
//
|
||||
this.toolStripStatusLabelSpeed.Name = "toolStripStatusLabelSpeed";
|
||||
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(65, 17);
|
||||
this.toolStripStatusLabelSpeed.Size = new System.Drawing.Size(80, 20);
|
||||
this.toolStripStatusLabelSpeed.Text = "Скорость: ";
|
||||
//
|
||||
// toolStripStatusLabelWeight
|
||||
//
|
||||
this.toolStripStatusLabelWeight.Name = "toolStripStatusLabelWeight";
|
||||
this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(32, 17);
|
||||
this.toolStripStatusLabelWeight.Size = new System.Drawing.Size(40, 20);
|
||||
this.toolStripStatusLabelWeight.Text = "Вес: ";
|
||||
//
|
||||
// toolStripStatusLabelBodyColor
|
||||
//
|
||||
this.toolStripStatusLabelBodyColor.Name = "toolStripStatusLabelBodyColor";
|
||||
this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(75, 17);
|
||||
this.toolStripStatusLabelBodyColor.Size = new System.Drawing.Size(95, 20);
|
||||
this.toolStripStatusLabelBodyColor.Text = "Цвет кузова:";
|
||||
//
|
||||
// buttonCreate
|
||||
//
|
||||
this.buttonCreate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreate.Location = new System.Drawing.Point(25, 272);
|
||||
this.buttonCreate.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonCreate.Location = new System.Drawing.Point(29, 363);
|
||||
this.buttonCreate.Name = "buttonCreate";
|
||||
this.buttonCreate.Size = new System.Drawing.Size(82, 22);
|
||||
this.buttonCreate.Size = new System.Drawing.Size(94, 29);
|
||||
this.buttonCreate.TabIndex = 2;
|
||||
this.buttonCreate.Text = "Создать";
|
||||
this.buttonCreate.UseVisualStyleBackColor = true;
|
||||
@ -103,10 +100,9 @@
|
||||
this.buttonLEFT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonLEFT.BackgroundImage = global::Traktor.Properties.Resources.arrowLeft;
|
||||
this.buttonLEFT.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonLEFT.Location = new System.Drawing.Point(589, 271);
|
||||
this.buttonLEFT.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonLEFT.Location = new System.Drawing.Point(673, 361);
|
||||
this.buttonLEFT.Name = "buttonLEFT";
|
||||
this.buttonLEFT.Size = new System.Drawing.Size(26, 22);
|
||||
this.buttonLEFT.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonLEFT.TabIndex = 3;
|
||||
this.buttonLEFT.UseVisualStyleBackColor = true;
|
||||
this.buttonLEFT.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
@ -116,10 +112,9 @@
|
||||
this.buttonRIGHT.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonRIGHT.BackgroundImage = global::Traktor.Properties.Resources.arrowRight;
|
||||
this.buttonRIGHT.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonRIGHT.Location = new System.Drawing.Point(652, 271);
|
||||
this.buttonRIGHT.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonRIGHT.Location = new System.Drawing.Point(745, 361);
|
||||
this.buttonRIGHT.Name = "buttonRIGHT";
|
||||
this.buttonRIGHT.Size = new System.Drawing.Size(26, 22);
|
||||
this.buttonRIGHT.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonRIGHT.TabIndex = 4;
|
||||
this.buttonRIGHT.UseVisualStyleBackColor = true;
|
||||
this.buttonRIGHT.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
@ -129,10 +124,9 @@
|
||||
this.buttonDOWN.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonDOWN.BackgroundImage = global::Traktor.Properties.Resources.arrowDown;
|
||||
this.buttonDOWN.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonDOWN.Location = new System.Drawing.Point(620, 284);
|
||||
this.buttonDOWN.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonDOWN.Location = new System.Drawing.Point(709, 379);
|
||||
this.buttonDOWN.Name = "buttonDOWN";
|
||||
this.buttonDOWN.Size = new System.Drawing.Size(26, 22);
|
||||
this.buttonDOWN.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonDOWN.TabIndex = 5;
|
||||
this.buttonDOWN.UseVisualStyleBackColor = true;
|
||||
this.buttonDOWN.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
@ -142,10 +136,9 @@
|
||||
this.buttonUP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonUP.BackgroundImage = global::Traktor.Properties.Resources.arrowUp;
|
||||
this.buttonUP.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
|
||||
this.buttonUP.Location = new System.Drawing.Point(620, 257);
|
||||
this.buttonUP.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.buttonUP.Location = new System.Drawing.Point(709, 343);
|
||||
this.buttonUP.Name = "buttonUP";
|
||||
this.buttonUP.Size = new System.Drawing.Size(26, 22);
|
||||
this.buttonUP.Size = new System.Drawing.Size(30, 29);
|
||||
this.buttonUP.TabIndex = 6;
|
||||
this.buttonUP.UseVisualStyleBackColor = true;
|
||||
this.buttonUP.Click += new System.EventHandler(this.ButtonMove_Click);
|
||||
@ -153,9 +146,10 @@
|
||||
// buttonCreateModif
|
||||
//
|
||||
this.buttonCreateModif.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.buttonCreateModif.Location = new System.Drawing.Point(113, 272);
|
||||
this.buttonCreateModif.Location = new System.Drawing.Point(129, 363);
|
||||
this.buttonCreateModif.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.buttonCreateModif.Name = "buttonCreateModif";
|
||||
this.buttonCreateModif.Size = new System.Drawing.Size(110, 22);
|
||||
this.buttonCreateModif.Size = new System.Drawing.Size(126, 29);
|
||||
this.buttonCreateModif.TabIndex = 7;
|
||||
this.buttonCreateModif.Text = "Модификация";
|
||||
this.buttonCreateModif.UseVisualStyleBackColor = true;
|
||||
@ -166,18 +160,20 @@
|
||||
this.comboBoxSelector.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxSelector.FormattingEnabled = true;
|
||||
this.comboBoxSelector.Items.AddRange(new object[] {
|
||||
"Простая карта"});
|
||||
this.comboBoxSelector.Location = new System.Drawing.Point(12, 12);
|
||||
"Простая карта",
|
||||
"Поле"});
|
||||
this.comboBoxSelector.Location = new System.Drawing.Point(14, 16);
|
||||
this.comboBoxSelector.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
|
||||
this.comboBoxSelector.Name = "comboBoxSelector";
|
||||
this.comboBoxSelector.Size = new System.Drawing.Size(121, 23);
|
||||
this.comboBoxSelector.Size = new System.Drawing.Size(138, 28);
|
||||
this.comboBoxSelector.TabIndex = 8;
|
||||
this.comboBoxSelector.SelectedIndexChanged += new System.EventHandler(this.ComboBoxSelector_SelectedIndexChanged);
|
||||
//
|
||||
// FormMap
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(700, 338);
|
||||
this.ClientSize = new System.Drawing.Size(800, 451);
|
||||
this.Controls.Add(this.comboBoxSelector);
|
||||
this.Controls.Add(this.buttonCreateModif);
|
||||
this.Controls.Add(this.buttonUP);
|
||||
@ -187,7 +183,6 @@
|
||||
this.Controls.Add(this.buttonCreate);
|
||||
this.Controls.Add(this.pictureBoxTraktor);
|
||||
this.Controls.Add(this.statusStrip);
|
||||
this.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
|
||||
this.Name = "FormMap";
|
||||
this.Text = "Трактор";
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBoxTraktor)).EndInit();
|
||||
|
@ -67,8 +67,7 @@ namespace Traktor
|
||||
Random random = new Random();
|
||||
var _Traktor = new MultiTraktorDraw(random.Next(100, 200), random.Next(2500, 5000),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)),
|
||||
Convert.ToBoolean(random.Next(0, 2)), Convert.ToBoolean(random.Next(0, 2)));
|
||||
Color.FromArgb(random.Next(0, 256), random.Next(0, 256), random.Next(0, 256)));
|
||||
SetData(_Traktor);
|
||||
}
|
||||
|
||||
@ -79,6 +78,9 @@ namespace Traktor
|
||||
case "Простая карта":
|
||||
_abstractMap = new SimpleMap();
|
||||
break;
|
||||
case "Поле":
|
||||
_abstractMap = new FieldMap();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,22 +11,14 @@ namespace Traktor
|
||||
{
|
||||
/// Дополнительный цвет
|
||||
public Color DopColor { get; private set; }
|
||||
/// Признак наличия ковша спереди
|
||||
public bool KovshFront { get; private set; }
|
||||
/// Признак наличия ковша сзади
|
||||
public bool KovshBack { get; private set; }
|
||||
/// Инициализация свойств
|
||||
/// <param name="speed">Скорость</param>
|
||||
/// <param name="weight">Вес трактора</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
/// <param name="kovshFront">Признак наличия ковша спереди</param>
|
||||
/// <param name="kovshBack">Признак наличия ковша сзади</param>
|
||||
public MultiTraktor(int speed, float weight, Color bodyColor, Color dopColor, bool kovshFront, bool kovshBack) : base(speed, weight, bodyColor)
|
||||
public MultiTraktor(int speed, float weight, Color bodyColor, Color dopColor) : base(speed, weight, bodyColor)
|
||||
{
|
||||
DopColor = dopColor;
|
||||
KovshFront = kovshFront;
|
||||
KovshBack = kovshBack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,11 @@ namespace Traktor
|
||||
/// <param name="weight">Вес трактора</param>
|
||||
/// <param name="bodyColor">Цвет кузова</param>
|
||||
/// <param name="dopColor">Дополнительный цвет</param>
|
||||
/// <param name="kovshFront">Признак наличия ковша спереди</param>
|
||||
/// <param name="kovshBack">Признак наличия ковша сзади</param>
|
||||
/// <param name="trktrWidth">Ширина отрисовки автомобиля</param>
|
||||
/// <param name="trktrHeight">Высота отрисовки автомобиля</param>
|
||||
public MultiTraktorDraw(int speed, float weight, Color bodyColor, Color dopColor, bool kovshFront, bool kovshBack) : base(speed, weight, bodyColor, 188, 100)
|
||||
public MultiTraktorDraw(int speed, float weight, Color bodyColor, Color dopColor) : base(speed, weight, bodyColor, 188, 100)
|
||||
{
|
||||
Traktor = new MultiTraktor(speed, weight, bodyColor, dopColor, kovshFront, kovshBack);
|
||||
Traktor = new MultiTraktor(speed, weight, bodyColor, dopColor);
|
||||
}
|
||||
|
||||
public override void DrawEntity(Graphics g)
|
||||
@ -40,70 +38,51 @@ namespace Traktor
|
||||
PointF point3;
|
||||
PointF point4;
|
||||
|
||||
bool Draw = false;
|
||||
if (multiTraktor.KovshBack)
|
||||
{
|
||||
g.DrawRectangle(pen_Black_1pxl, startPosX, startPosY + 8, 4, 35);
|
||||
g.DrawRectangle(pen_Black_1pxl, startPosX + 33, startPosY + 34, 10, 15);
|
||||
g.DrawRectangle(pen_Black_1pxl, startPosX, startPosY + 8, 4, 35);
|
||||
g.DrawRectangle(pen_Black_1pxl, startPosX + 33, startPosY + 34, 10, 15);
|
||||
|
||||
point1 = new PointF(startPosX, startPosY + 8);
|
||||
point2 = new PointF(startPosX + 33, startPosY + 41);
|
||||
point3 = new PointF(startPosX + 33, startPosY + 34);
|
||||
point4 = new PointF(startPosX + 7, startPosY + 8);
|
||||
PointF[] curvePoints =
|
||||
{
|
||||
point1 = new PointF(startPosX, startPosY + 8);
|
||||
point2 = new PointF(startPosX + 33, startPosY + 41);
|
||||
point3 = new PointF(startPosX + 33, startPosY + 34);
|
||||
point4 = new PointF(startPosX + 7, startPosY + 8);
|
||||
PointF[] curvePoints =
|
||||
{
|
||||
point1,
|
||||
point2,
|
||||
point3,
|
||||
point4
|
||||
};
|
||||
g.FillPolygon(dopBrush, curvePoints);
|
||||
g.DrawPolygon(pen_Black_1pxl, curvePoints);
|
||||
g.FillPolygon(dopBrush, curvePoints);
|
||||
g.DrawPolygon(pen_Black_1pxl, curvePoints);
|
||||
|
||||
point1 = new PointF(startPosX + 6, startPosY + 8 + 15);
|
||||
point2 = new PointF(startPosX + 6, startPosY + 8 + 35);
|
||||
point3 = new PointF(startPosX + 26, startPosY + 8 + 35);
|
||||
PointF[] curvePoints2 =
|
||||
point1 = new PointF(startPosX + 6, startPosY + 8 + 15);
|
||||
point2 = new PointF(startPosX + 6, startPosY + 8 + 35);
|
||||
point3 = new PointF(startPosX + 26, startPosY + 8 + 35);
|
||||
PointF[] curvePoints2 =
|
||||
{
|
||||
point1,
|
||||
point2,
|
||||
point3
|
||||
};
|
||||
g.FillPolygon(dopBrush, curvePoints2);
|
||||
g.DrawPolygon(pen_Black_1pxl, curvePoints2);
|
||||
g.FillPolygon(dopBrush, curvePoints2);
|
||||
g.DrawPolygon(pen_Black_1pxl, curvePoints2);
|
||||
|
||||
startPosX += 43;
|
||||
base.DrawEntity(g);
|
||||
startPosX -= 43;
|
||||
Draw = true;
|
||||
}
|
||||
startPosX += 43;
|
||||
base.DrawEntity(g);
|
||||
startPosX -= 43;
|
||||
|
||||
if (multiTraktor.KovshFront)
|
||||
point1 = new PointF(startPosX + 43 + 102, startPosY + 30);
|
||||
point2 = new PointF(startPosX + 43 + 102, startPosY + 65);
|
||||
point3 = new PointF(startPosX + 43 + 137, startPosY + 65);
|
||||
|
||||
PointF[] curvePoints3 =
|
||||
{
|
||||
if (Draw)
|
||||
{
|
||||
point1 = new PointF(startPosX + 43 + 102, startPosY + 30);
|
||||
point2 = new PointF(startPosX + 43 + 102, startPosY + 65);
|
||||
point3 = new PointF(startPosX + 43 + 137, startPosY + 65);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
point1 = new PointF(startPosX + 102, startPosY + 30);
|
||||
point2 = new PointF(startPosX + 102, startPosY + 65);
|
||||
point3 = new PointF(startPosX + 137, startPosY + 65);
|
||||
base.DrawEntity(g);
|
||||
}
|
||||
PointF[] curvePoints =
|
||||
{
|
||||
point1,
|
||||
point2,
|
||||
point3
|
||||
};
|
||||
g.FillPolygon(dopBrush, curvePoints);
|
||||
g.DrawPolygon(pen_Black_1pxl, curvePoints);
|
||||
}
|
||||
if (!Draw) { base.DrawEntity(g); }
|
||||
};
|
||||
g.FillPolygon(dopBrush, curvePoints3);
|
||||
g.DrawPolygon(pen_Black_1pxl, curvePoints3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ namespace Traktor
|
||||
_map[i, j] = _freeRoad;
|
||||
}
|
||||
}
|
||||
while (counter < 50)
|
||||
while (counter < 33)
|
||||
{
|
||||
int x = _random.Next(0, 100);
|
||||
int y = _random.Next(0, 100);
|
||||
|
Loading…
x
Reference in New Issue
Block a user