예제 #1
0
        public static void SaveFile()
        {
            SaveData data = new SaveData();

            DataStorage.SaveFile(data);
            Objectives.SaveFile(data);

            BinaryFormatter binaryFormatter = new BinaryFormatter();
            MemoryStream    memoryStream    = new MemoryStream();

            binaryFormatter.Serialize(memoryStream, data);
            byte[] bytes = memoryStream.ToArray();
            memoryStream.Dispose();

            SaveLoad.AutoSaveGame(bytes, slotNumber, slotParams, controlFlags);
        }
예제 #2
0
        void StartSaveLoad()
        {
            Main.Initialise();
            SaveLoad.OnGameLoaded += OnSavedGameLoaded;
            SaveLoad.OnLoadError  += OnLoadError;
            SaveLoad.OnLoadNoData += OnLoadNoData;
            SaveLoad.Initialise();

            slotParams.title    = "Gunhouse";
            slotParams.subTitle = "Load your guns! Rain death from above!";
            slotParams.detail   = "Save Data";
            slotParams.iconPath = Path.Combine(Application.streamingAssetsPath, "SaveIcon.png");

            DataStorage.ResetValues();
            Objectives.ResetValues();
        }
예제 #3
0
        public virtual void damage(float by, Gun.Ammo type)
        {
            if (hp <= 0)
            {
                return;
            }

            max_hp = max_hp == 0 ? hp : max_hp;

            float amt = (by * Gun.UpgradeMultiplier(type));

            if (!Target.damages.ContainsKey(type))
            {
                Target.damages[type] = 0;
            }
            Target.damages[type] += amt;

            hp -= amt;
            if (hp <= 0)
            {
                releaseOrphans();

                for (int i = 0; i < skulls.Count; ++i)
                {
                    skulls[i].explosion_timeout = 0;
                }
                frozen = 0;
                spiked = 0;
                startDying();
                Game.instance.house.addScore((int)max_hp, position);
                remove = true;
                Game.instance.dead_group.add(this);

                Objectives.DefeatedWithAmmo(type);
            }

            if (flash_timeout <= 0)
            {
                flashing = House.flash_length;
                float health = hp / (float)max_hp;
                flash_timeout = (int)(health * House.flash_max_timeout + (1 - health) * House.flash_min_timeout);
            }
        }
예제 #4
0
        void OnSavedGameLoaded(Messages.PluginMessage msg)
        {
            byte[] bytes = SaveLoad.GetLoadedGame();
            if (bytes == null)
            {
                SceneManager.LoadSceneAsync((int)SceneIndex.Main); return;
            }

            SaveData data;

            using (MemoryStream memoryStream = new MemoryStream()) {
                BinaryFormatter binaryFormatter = new BinaryFormatter();
                memoryStream.Write(bytes, 0, bytes.Length);
                memoryStream.Seek(0, SeekOrigin.Begin);
                data = (SaveData)binaryFormatter.Deserialize(memoryStream);
            }

            DataStorage.LoadFile(data);
            Objectives.LoadFile(data);

            SceneManager.LoadSceneAsync((int)SceneIndex.Main);
        }
예제 #5
0
 public static void SaveEndWave()
 {
     Objectives.SaveFile(); DataStorage.SaveEndWave();
 }
예제 #6
0
 public static void SavePlayerData()
 {
     DataStorage.SaveFile(); Objectives.SaveFile();
 }
예제 #7
0
 public static void LoadPlayerData()
 {
     DataStorage.LoadFile(); Objectives.LoadFile();
 }
예제 #8
0
 public static void SaveEndWave()
 {
     Objectives.Save(); DataStorage.Save(); PlayerPrefs.Save();
 }
예제 #9
0
 public static void LoadPlayerData()
 {
     DataStorage.Load(); Objectives.Load(); PlayerPrefs.Save();
 }
예제 #10
0
 public static void DeleteFile()
 {
     SaveLoad.Delete(0, false);
     DataStorage.ResetValues();
     Objectives.ResetValues();
 }