Ejemplo n.º 1
0
        private void SaveGame(String fileName)
        {
            StorageHandler.SaveGameData save = new StorageHandler.SaveGameData();

            save.lives = player.Lives;
            save.gold  = player.Gold;
            save.wave  = player.Wave;

            //Turn the map into a one dimensional array as the xml serializer does not support multidimensional arrays.
            int[] singleDimMap = new int[map.Height * map.Width];
            int   i            = 0;

            for (int y = 0; y < map.Height; y++)
            {
                for (int x = 0; x < map.Width; x++)
                {
                    singleDimMap[i] = map.GetIndex(x, y);
                    i++;
                }
            }
            save.map = singleDimMap;

            storageHandler.SaveGame(save, "Immunity_Container", fileName + ".sav");
        }
Ejemplo n.º 2
0
        private void SaveGame(String fileName)
        {
            StorageHandler.SaveGameData save = new StorageHandler.SaveGameData();

            save.lives = player.Lives;
            save.gold = player.Gold;
            save.wave = player.Wave;

            //Turn the map into a one dimensional array as the xml serializer does not support multidimensional arrays.
            int[] singleDimMap = new int[map.Height * map.Width];
            int i = 0;
            for (int y = 0; y < map.Height; y++)
            {
                for (int x = 0; x < map.Width; x++)
                {
                    singleDimMap[i] = map.GetIndex(x, y);
                    i++;
                }
            }
            save.map = singleDimMap;

            storageHandler.SaveGame(save, "Immunity_Container", fileName + ".sav");
        }