/// <summary> /// Initialize /// </summary> override public void Setup () { // initialize singleton use = this; // initialize events CubeSet.NeighborAddEvent += OnNeighborAdd; CubeSet.NeighborRemoveEvent += OnNeighborRemove; // initialize MazeCubes foreach (Cube cube in CubeSet) { mazeCubes.Add(new MazeCube(cube)); } // create players for (int i=0; i<numPlayers; i++) { players.Add(new Player(i)); playerCubes.Add(mazeCubes[i]); } XmlMazeReader mazeReader = new XmlMazeReader(); // instantiate a MazeManager and generate a level new MazeManager(); //MazeManager.use.GenerateRandomMaze(3); mazeReader.setUpMap("../../assets/maps/sampleMap.xml", MazeManager.use, players); for (int i=0; i<players.Count; i++) { playerCubes[i].owner = players[i]; } foreach (MazeCube c in playerCubes) { c.currentRoom = c.owner.currentRoom; } // draw the cubes to start with foreach (MazeCube c in mazeCubes) { c.PaintCube(); } }
/// <summary> /// Initialize /// </summary> public override void Setup() { // initialize singleton use = this; // initialize events CubeSet.NeighborAddEvent += OnNeighborAdd; CubeSet.NeighborRemoveEvent += OnNeighborRemove; // initialize number of turns turnsRemaining = maxNumberTurns; // initialize victory state arePlayersVictorious = false; // initialize EntityManager singleton new EntityManager(); // initialize MazeCubes mazeCubes = new List<MazeCube>(); foreach (Cube cube in CubeSet) { mazeCubes.Add(new MazeCube(cube)); } // create players players = new List<Player>(); for (int i=0; i<numPlayers; i++) { players.Add(new Player(i)); } // load the maze XmlMazeReader mazeReader = new XmlMazeReader(); new MazeManager(); mazeReader.setUpMap("../../assets/maps/Map1.xml", MazeManager.use, players); // assign players to cubes for (int i=0; i<players.Count; i++) { mazeCubes[i].owner = players[i]; } foreach (MazeCube c in playerCubes) { c.currentRoom = c.owner.currentRoom; } // draw the cubes to start with foreach (MazeCube c in mazeCubes) { c.Paint(); } }