// Population Methods public void place(Shinobi shinobi, int x, int y, int z) { bool placed = false; for (int w = x; w <= x + shinobi.getWidth() - 1; w++) { for (int d = y; d <= y + shinobi.getDepth() - 1; d++) { for (int h = z; h <= z + shinobi.getHeight() - 1; h++) { //Console.WriteLine(space[w, d, h]); if (space[w, d, h] == null) { space[w, d, h] = shinobi; shinobi.setCoor(x, y, z); placed = true; } else { placed = false; } } } } if (!placed) { Console.WriteLine("There's no space for that!"); } else { Console.WriteLine("Shinobi placed at {0}, {1}, {2}.", x, y, z); } }
static void Main(string[] args) { // Just getting my bearings here... drawValley(36); Console.ReadLine(); Shinobi player = new Shinobi(); Console.ReadLine(); Console.WriteLine("Oh! Hello there! My name is Zigzo. What's your name?"); player.setName(Console.ReadLine()); Console.WriteLine("{0} is it? That's a weird name... You're not from around here, are you? How old are you anyway?", player.getName()); player.setAge(Convert.ToInt32(Console.ReadLine())); Console.WriteLine("You're {0}, huh?", player.getAge()); Location Konoha = new Location("Konoha", 40, 40, 40); player.setHeight(10); Konoha.place(player, 0, 0, 0); Konoha.place(player, 0, 0, 10); //Konoha.place(player, 0, 0, 9); Konoha.showTop(); Konoha.showRight(); Console.ReadLine(); }