public void Save(SaveData data) { int count = 0; data.Add("enemyCount", enemies.Count); foreach (GameObject enemy in enemies) { if (enemy == null) { continue; } ISavable[] savables = enemy.GetComponents <ISavable>(); if (savables.Length == 0) { continue; } string prefix = "enemy_" + count++ + "_"; data.Prefix = prefix; data.Add("prefab_path", ResourcesPathHelper.GetEnemyPath(enemy.name)); foreach (ISavable sav in savables) { sav.Save(data); data.Prefix = prefix; //reset prefix after each save } } data.Prefix = ""; exitDoor.Save(data); }
public void Save(SaveData data) { containers.RemoveAll(x => x == null); int count = containers.Count; data.Add("count", count); for (int i = 0; i < count; i++) { Container cont = containers[i]; data.Prefix = "cont_" + i + "_"; cont.transform.position.ToSaveData(data, "pos"); cont.transform.rotation.eulerAngles.ToSaveData(data, "rot"); string path = ResourcesPathHelper.GetContainerPath(cont); if (path != null) { data.Add("path", path); } cont.Save(data); } }
public void Save(SaveData data) { string origPrefix = data.Prefix; IItem[] items = Items; int count = items.Length; data.Add("itemCount", count); for (int i = 0; i < count; i++) { IItem item = items[i]; data.Prefix = origPrefix + "Item_" + i + "_"; data.Add("path", ResourcesPathHelper.GetItemPath(item)); item.Save(data); } data.Prefix = origPrefix; data.Add("enabled", this.enabled); }
public void Save(SaveData data) { data.Add("effectName", effectName); data.Add("remainingTime", remainingTime); data.Add("movementMultiplier", movementMultiplier); data.Add("style", style.ToString()); data.Add("type", type.ToString()); }
public void Save(SaveData data) { data.Add("type", GetType().ToString()); data.Add("left", ammoLeft); //save projectile prefab if (projectilePrefab != null) { data.Add("projectilePath", ResourcesPathHelper.GetProjectilePath(projectilePrefab.name)); } }
public void SaveGameState() { SaveData data = new SaveData(); data.Add("SoftCurrency", SoftCurrency); data.Add("DonateCurrency", DonateCurrency); if (Serialization.SaveToBinnary <SaveData>(data)) { Debug.Log("Game saved succesfuly"); } else { Debug.Log("Game not saved"); } }
// // Methods public void AddSave(AppData dataToSave) { this.CurrentData = dataToSave; if (SaveData.Count == 1) { SaveData.RemoveAt(0); } SaveData.Add(dataToSave); }
public void SaveGame() { SaveData data = new SaveData(); foreach (var item in createdPrefabs) { data.Add(item.transform.position); } var dataToSave = JsonUtility.ToJson(data); saveSystem.SaveData(dataToSave); }
public void Save(SaveData data) { IItem[] items = Items; int count = items.Length; data.Add("count", count); for (int i = 0; i < count; i++) { IItem item = items[i]; data.Prefix = "Item_" + i + "_"; data.Add("path" + i, ResourcesPathHelper.GetItemPath(item)); item.Save(data); } data.Prefix = ""; }
public void Save(SaveData data) { string origPrefix = data.Prefix; // save original Prefix before editing it List <IEffect> toSave = effects.FindAll(x => x.ShouldBeSaved); int count = toSave.Count; data.Add("count", count); for (int i = 0; i < count; i++) { IEffect effect = toSave[i]; data.Prefix = origPrefix + "effect_" + i + "_"; data.Add("classType", effect.GetType().ToString()); effect.Save(data); } }
public void Save(SaveData data) { data.Add("StatsUnspent", unspentPoints); data.Add("StatsStrength", Stats.Strength); data.Add("StatsDefense", Stats.Defense); data.Add("StatsStamina", Stats.Stamina); data.Add("StatsEnergy", Stats.Energy); data.Add("CurrentLevel", currentLevel); data.Add("CurrentExp", currentExp); }
public void Save(SaveData data) { pickables.RemoveAll(x => x == null); int count = pickables.Count; data.Add("count", count); for (int i = 0; i < count; i++) { Pickable pick = pickables[i]; data.Prefix = "pick_" + i + "_"; pick.transform.position.ToSaveData(data, "pos"); pick.transform.rotation.eulerAngles.ToSaveData(data, "rot"); string path = ResourcesPathHelper.GetPickablePath(pick); if (path != null) { data.Add("path", path); } //UserData can be anything, serializing it to string to save it if (pick.UserData != null && pick.UserData.GetType().IsSerializable) { StringWriter writer = new StringWriter(); XmlSerializer xmlSerializer = new XmlSerializer(pick.UserData.GetType()); // We Use XML Serializer to be able to write in a StringWriter xmlSerializer.Serialize(writer, pick.UserData); data.Add("userDataType", pick.UserData.GetType().ToString()); data.Add("userData", writer.ToString()); } } }
public void SaveGameState() { SaveData data = new SaveData(); data.Add("LastCompletedLevel", LastCompletedLevel); if (Serialization.SaveToBinnary <SaveData>(data)) { Debug.Log("Game saved"); } else { Debug.Log("Game not saved"); } }
public void Save(string saveName, XElement node) { this.LoadData(); XElement nodeToDel = this.GetSave(saveName); if (nodeToDel != null) { nodeToDel.Remove(); } XElement saveNode = new XElement("save"); saveNode.SetAttributeValue("name", saveName); saveNode.Add(node); SaveData.Add(saveNode); WriteData(); }
private static void SaveSnapShots() { var saveData = new SaveData(); var guids = AssetDatabase.FindAssets("t:scriptableObject"); foreach (var guid in guids) { var asset = AssetDatabase.LoadAssetAtPath <ScriptableObject> (AssetDatabase.GUIDToAssetPath(guid)); if (asset is IResetOnPlayModeExit) { saveData.Add(asset); } } EditorPrefs.SetString(PrefsSaveKey, JsonUtility.ToJson(saveData)); }
public void Save(SaveData data) { data.Add("name", name); data.Add("remainingTime", remainingTime); data.Add("tickTime", tickTime); data.Add("minTickDamages", minTickDamages); data.Add("maxTickDamages", maxTickDamages); data.Add("type", type.ToString()); }
public void Save(SaveData data) { data.Add("MaxHealth", MaxHealth); data.Add("CurrentHealth", CurrentHealth); }
public static void ToSaveData(this Vector3 vector, SaveData data, string name) { data.Add(name + "X", vector.x); data.Add(name + "Y", vector.y); data.Add(name + "Z", vector.z); }
public void Save(SaveData data) { data.Add("ammoCount", ammoLeft); }
public void Save(SaveData data) { data.Add("seed", seed); data.Add("stage", stage); mazeInstance.Save(data); }
public void Save(SaveData data) { data.Add("MaxMana", MaxMana); data.Add("CurrentMana", CurrentMana); }
public void Save(SaveData data) { data.Add("stageValue", stageValue); }
public void Save(SaveData data) { data.Add("locked", locked); data.Add("delta", delta); }
public void Save(SaveData data) { string path = ResourcesPathHelper.GetWeaponPath(this.WeaponType, this.name); data.Add("path", path); }