public void Setup(bool same) { if (!same) //If new map { map = new GameMap(); map.Start(); } endGame = false; //setup wump = new Wumpus(); player = new Player(); bats = new Bat(); wump.room = map.getWump(); player.room = map.getCurrent(); int[] temp = map.getAdjacent(player.room); doors[0] = GameObject.Find("Left Door"); doors[1] = GameObject.Find("Middle Door"); doors[2] = GameObject.Find("Right Door"); for (int i = 0; i < 3; i++) { doors[i].GetComponent<Door>().doorNum = temp[i]; } bats.room = map.getBat(); currentNum.text = "Current Room: " + player.room; //GameObject[] doors = FindObjectsOfType(typeof(Door)) as GameObject[]; for (int i = 0; i < 20; i++) { rooms[i] = GameObject.Find("/Rooms/Room (" + i + ")"); } Warnings(); //check for initial warnings }
public void Setup(bool same) { if (!same) //If new map { map = new GameMap(); map.Start(); } endGame = false; //setup wump = new Wumpus(); player = new Player(); bats = new Bat(); wump.room = map.getWump(); player.room = map.getCurrent(); int[] temp = map.getAdjacent(player.room); doors[0] = GameObject.Find("Left Door"); doors[1] = GameObject.Find("Middle Door"); doors[2] = GameObject.Find("Right Door"); for (int i = 0; i < 3; i++) { doors[i].GetComponent <Door>().doorNum = temp[i]; } bats.room = map.getBat(); currentNum.text = "Current Room: " + player.room; //GameObject[] doors = FindObjectsOfType(typeof(Door)) as GameObject[]; for (int i = 0; i < 20; i++) { rooms[i] = GameObject.Find("/Rooms/Room (" + i + ")"); } Warnings(); //check for initial warnings }
public void Start() { NetworkMsg msg = new ReplyStart(true); gameMap.Start(players); roomBroadCast(msg); bStart = true; // preTimer.Start(); }
public void Setup(bool same) { if (!same) //If new map { map = new GameMap(); map.Start(); } endGame = false; //setup wump = new Wumpus(); player = new Player(); bats = new Bat(); wump.room = map.getWump(); player.room = map.getCurrent(); bats.room = map.getBat(); for (int i = 0; i < 20; i++) { rooms[i] = GameObject.Find("Room (" + i + ")"); rooms[i].GetComponent<Room>().player = false; } Warnings(); //check for initial warnings rooms[player.room].GetComponent<Room>().player = true; //show player room }
public void Setup(bool same) { if (!same) //If new map { map = new GameMap(); map.Start(); } endGame = false; //setup wump = new Wumpus(); player = new Player(); bats = new Bat(); wump.room = map.getWump(); player.room = map.getCurrent(); bats.room = map.getBat(); for (int i = 0; i < 20; i++) { rooms[i] = GameObject.Find("Room (" + i + ")"); rooms[i].GetComponent <Room>().player = false; } Warnings(); //check for initial warnings rooms[player.room].GetComponent <Room>().player = true; //show player room }
void Start() { bool debug = false; int size; int itemsCount; if (debug) { do { Clear(); WriteLine("Enter size"); }while (!int.TryParse(ReadLine(), out size)); do { Clear(); WriteLine("Enter count of items to generate"); }while (!int.TryParse(ReadLine(), out itemsCount)); } else { size = 5; itemsCount = 4; } while (true) { var gameMap = new GameMap(size, itemsCount, 2, new[] { 2, 4 }); gameMap.Start(); Clear(); bool cantMove = false; while (true) { Render(gameMap); SetCursorPosition(0, 4 + size); WriteLine("Your next move?"); if (cantMove) { WriteLine("Can't make move!"); } else { WriteLine(" "); } Write(" "); SetCursorPosition(0, CursorTop); var key1 = ReadKey(); if (key1.Key == ConsoleKey.Escape) { return; } if (key1.Key == ConsoleKey.Backspace) { break; } var key2 = ReadKey(); if (TryGetIndex(new string(new[] { key1.KeyChar, key2.KeyChar }), out int x, out int y)) { if (!gameMap.MakeMove(x, y)) { cantMove = true; } else { cantMove = false; } }