/// <summary> /// Creates a maze object from the given stream /// </summary> public Maze(Stream mazeStream, Viewport viewport) { // load the maze's size BinaryReader reader = new BinaryReader(mazeStream); width = reader.ReadInt32(); height = reader.ReadInt32(); // load the entrance and set the position to it at the start entrance = new Vector2(reader.ReadInt32(), reader.ReadInt32()); Reset(viewport); // load the exit exit = new Vector2(reader.ReadInt32()*GameVariables.TileSize, reader.ReadInt32()*GameVariables.TileSize); // load the tile array tiles = new bool[width][]; for (int x = 0; x < width; x++) { tiles[x] = new bool[height]; for (int y = 0; y < height; y++) { tiles[x][y] = reader.ReadBoolean(); } } reader.Close(); // Initalize the movables, torch, minotuars, and comrade lists Moveables = new List<Movable>(); torches = new List<Torch>(); comrades = new List<Comrade>(); minotaurs = new List<Minotaur>(); // Create the comrades in the maze for (int i = 0; i < width * height / GameVariables.ComradeRate; i++) { Comrade comrade = new Comrade(getRandomCell(entrance)); comrades.Add(comrade); Moveables.Add(comrade); } // Create the minotaurs in the maze for (int i = 0; i < width * height / GameVariables.MinotuarRate; i++) { Minotaur minotaur = new Minotaur(getRandomCell(entrance)); minotaurs.Add(minotaur); Moveables.Add(minotaur); } }
/// <summary> /// Removes the given comrade from the maze /// </summary> public void RemoveComrade(Comrade comrade) { Moveables.Remove(comrade); comrades.Remove(comrade); }