private void CreateStones() { Console.Write("Creating stones... "); var random = kernel.Get <Random>(); int tiles = World.SizeX * World.SizeY; int stones = random.Next(tiles / 5, tiles / 3); var pathfinder = new PathFinding.Pathfinder(World); IList <Tile> path; for (int n = 0; n < stones; n++) { Sprite sprite = kernel.Get <Stone>(); do { // Find tile Tile tile; do { tile = World.Tiles.Get(random.Next(World.SizeX), random.Next(World.SizeY)); } while (tile.Entities.Count > 1); // Set tile sprite.Tile = tile; } while ((path = pathfinder.FindPath(SpawnLeft.Tile, Arrival.Tile)) == null); } Console.WriteLine(" done."); }
public Network() { for (int i = 0; i < map.Length; i++) { map[i] = new Objects.Item[10]; } for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { Objects.Item item = new Objects.Item(); item.type = 0; map[i][j] = item; } } AI = new PathFinding.Pathfinder(); }