-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDijkstraAI.cs
35 lines (32 loc) · 1003 Bytes
/
DijkstraAI.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
namespace Roguelike
{
class DijkstraAI : IMonsterIntelligence
{
private void PutRegionToFile(Tile[,] region)
{
TileFactory fact = new TileFactory();
using (StreamWriter sw = new StreamWriter("Dijkstra.txt"))
{
for (int i = 0; i < region.GetLength(0); i++)
{
for (int j = 0; j < region.GetLength(1); j++)
{
sw.Write(fact.GetTile(region[i, j]).Symbol.ToString());
}
sw.Write("\n");
}
}
}
public void FindPath(Monster monster, BaseEntity target)
{
Tile[,] region = Program.GameEngine.GetMapRegion(monster.Coords.Invert(), target.Coords.Invert(), 0);
//PutRegionToFile(region);
}
}
}