//Override public void SaveObject() { lock (assetLock) { AssetWrapper wrap = new AssetWrapper(); string destination = SavePath + "/" + sceneName + ".dat"; FileStream file; if (File.Exists(destination)) { File.Delete(destination); file = File.OpenWrite(destination); } else { file = File.OpenWrite(destination); } foreach (Item item in items) { wrap.Push(item.state); } foreach (Enemy item in enemies) { wrap.Push(item.state); } foreach (Door item in doors) { wrap.Push(item.state); } foreach (CheckPointTrigger check in checkPoints) { wrap.Push(check.state); } BinaryFormatter bf = new BinaryFormatter(); bf.Serialize(file, wrap); } }