2022-09-26 23:17:44 +04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace AirFighter
|
|
|
|
|
{
|
|
|
|
|
internal class SimpleMap : AbstractMap
|
|
|
|
|
{
|
|
|
|
|
Brush barrierColor = new SolidBrush(Color.Black);
|
|
|
|
|
|
|
|
|
|
Brush roadColor = new SolidBrush(Color.Gray);
|
|
|
|
|
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++)
|
|
|
|
|
{
|
2022-09-27 04:01:32 +04:00
|
|
|
|
if (_random.Next(0, 90) == 5)
|
2022-09-26 23:17:44 +04:00
|
|
|
|
{
|
|
|
|
|
_map[i, j] = _barrier;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
_map[i, j] = _freeRoad;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|