Exemplo n.º 1
0
        public GameFile(SceneGameplay pScene)
        {
            serializableClass = new XmlGameFile();

            currentScene    = pScene;
            currentGameData = "";
        }
Exemplo n.º 2
0
        public void ImportingGameData()         //Get data from the file
        {
            XmlGameFile a = XmlGameFile.OpenFromXml(GameFileName);
            //Hero
            string posX = a.playerFile.PosX;
            string posY = a.playerFile.PosY;

            HeroPosition = new Vector2(float.Parse(posX), float.Parse(posY));

            //GameInfo
            CurrentTime = int.Parse(a.gameInfo.Time);
            CurrentMap  = a.gameInfo.CurrentMap;
        }
Exemplo n.º 3
0
        public void GetInventory(InventoryManager inventory)         //Get inventory from the file
        {
            inventory.Empty();

            XmlGameFile a = XmlGameFile.OpenFromXml(GameFileName);

            //Inventory
            for (int i = 0; i < a.inventoryFile.lstItem.Length; i++)
            {
                if (a.inventoryFile.lstItem[i].Number != null)
                {
                    inventory.AddObjectAt(int.Parse(a.inventoryFile.lstItem[i].Slot), a.inventoryFile.lstItem[i].ID,
                                          int.Parse(a.inventoryFile.lstItem[i].Number));
                }
                else
                {
                    inventory.AddObject(a.inventoryFile.lstItem[i].ID, 0);
                }
            }
        }