Example #1
0
        public void Start()
        {
            var generator = new RoomMazeGenerator();

            this.Map = generator.Generate(new RoomMazeGenerator.Settings
            {
                Width       = 21,
                Height      = 21,
                MinRoomSize = 5,
                MaxRoomSize = 9,
            });

            this.Astar = new VectorGridGraph(Map.Regions.GetLength(0), Map.Regions.GetLength(1));
            for (var x = 0; x < Map.Regions.GetLength(0); x++)
            {
                for (var y = 0; y < Map.Regions.GetLength(1); y++)
                {
                    if (!Map.Regions[x, y].HasValue)
                    {
                        this.Astar.Walls.Add(new Vector2(x, y));
                    }
                }
            }

            Connect("Bot1");
        }
Example #2
0
 public void Initialize(int mapWidth, int mapHeight)
 {
     astar = new VectorGridGraph(mapWidth, mapHeight);
 }