public SerialUpgrade Save() { SerialUpgrade s = new SerialUpgrade(); s.id = uniqueID; s.unlocked = bought; return(s); }
public void Save() { SerialShip saveData = new SerialShip(); int[] partData = new int[boughtParts.Count]; SerialUpgrade[] upgradeData = new SerialUpgrade[upgrades.Length]; saveData.cockpitColor = shittyColor(cockpitColor); saveData.engineColor = shittyColor(engineColor); saveData.hullColor = shittyColor(hullColor); saveData.weaponColor = shittyColor(weaponColor); saveData.wingColor = shittyColor(wingColor); saveData.cockpitIndex = cockpitIndex; saveData.engineIndex = engineIndex; saveData.hullIndex = hullIndex; saveData.weaponIndex = weaponIndex; saveData.wingIndex = wingIndex; int i = 0; foreach (Upgrade u in upgrades) { upgradeData[i++] = u.Save(); } i = 0; foreach (int j in boughtParts) { partData[i++] = j; } saveData.unlockedParts = partData; saveData.upgrades = upgradeData; BinaryFormatter bf = new BinaryFormatter(); FileStream fs = File.Create(Application.persistentDataPath + "/ship" + currentSaveID + ".ass"); bf.Serialize(fs, saveData); fs.Close(); }
public void Save() { SerialShip saveData = new SerialShip(); int[] partData = new int[boughtParts.Count]; SerialUpgrade[] upgradeData = new SerialUpgrade[upgrades.Length]; saveData.cockpitColor = shittyColor (cockpitColor); saveData.engineColor = shittyColor (engineColor); saveData.hullColor = shittyColor (hullColor); saveData.weaponColor = shittyColor (weaponColor); saveData.wingColor = shittyColor (wingColor); saveData.cockpitIndex = cockpitIndex; saveData.engineIndex = engineIndex; saveData.hullIndex = hullIndex; saveData.weaponIndex = weaponIndex; saveData.wingIndex = wingIndex; int i = 0; foreach (Upgrade u in upgrades) upgradeData[i++] = u.Save(); i = 0; foreach (int j in boughtParts) partData[i++] = j; saveData.unlockedParts = partData; saveData.upgrades = upgradeData; BinaryFormatter bf = new BinaryFormatter(); FileStream fs = File.Create (Application.persistentDataPath + "/ship" + currentSaveID + ".ass"); bf.Serialize (fs, saveData); fs.Close (); }
public SerialUpgrade Save() { SerialUpgrade s = new SerialUpgrade(); s.id = uniqueID; s.unlocked = bought; return s; }