Exemplo n.º 1
0
Arquivo: Map.cs Projeto: jhedin/Tilt
        public Map(string path, MapParser inputParams, globals gIn)
        {
            currentRoom = 0;
            //roomMax = 0;
            tileSetName = inputParams.backgroundName;
            numberOfRooms = inputParams.numberOfRooms;
            tileKey = inputParams.tileKey;
            lastRoom = inputParams.lastRoom;
            collisionKey = inputParams.collisionKey;
            colsPerRow = inputParams.colsPerRow;
            roomX = inputParams.roomX;
            roomY = inputParams.roomY;
            rooms = new List<Room>();
            for (int roomNo = 0; roomNo < numberOfRooms; roomNo++)
            {
                rooms.Add(new Room(inputParams.roomData[roomNo]));
                rooms[roomNo].init(collisionKey);
            }

            g = gIn;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            g.state = GameState.init;
            String path = "Content/tilt_1.txt";
            path = Path.Combine(StorageContainer.TitleLocation, path);
            MapParser newMap;
            if (File.Exists(path))
            {
                 newMap = new MapParser(path);
            }
            else
            {
                throw new Exception("No levels found.");
            }

            path = "Content/" + newMap.backgroundName + "_key.key";
            path = Path.Combine(StorageContainer.TitleLocation, path);
            if (File.Exists(path))
            {
                newMap.parseTilesetData(path);
            }
            else
            {
                throw new Exception("Tileset not found.");
            }
            g.map = new Map(StorageContainer.TitleLocation, newMap,g);

            path = "Content/";
            path = Path.Combine(StorageContainer.TitleLocation, path);
            /*if (File.Exists(path))
            {
                g.player = new Player(path, g);
            }
            else
            {
                throw new Exception("Player Tileset missing.");
            }*/
            g.player = new Player(path, g);
            g.highScores = new List<uint>();
            g.map.selectRoom(0);
            paws = new PauseMenu(g);
            mainMenu = new MainMenu(g);
            endMenu = new EndMenu(g);
            highScores = new HighScores(g);
            instructions = new InstructionsMenu(g);

            g.state = GameState.mainMenu;

            saveData = new SaveData();
            xmlSerializer = new XmlSerializer(typeof(SaveData));

            base.Initialize();
        }