// Save the inventory to disk public void saveToDisk(string owner) { var slot = SaveDataScript.inventory_owner_to_slot(owner); SaveDataScript.save_data.item_inventory[slot] = _items; SaveDataScript.save(); }
/* * This method is called before leaving the scene. * It shows the player and enables movement for the overworld player object. * After that it sets the player's sceneload data to the correct source and destination */ protected override void prepare_to_leave_scene(string destination, string source) { // save rupees var save_index = SaveDataScript.map_to_slot(dungeon_color); var rupees = SaveDataScript.save_data.dungeon_data[save_index]; GameObject[] g = GameObject.FindGameObjectsWithTag("Rupee"); for (int i = 0; i < g.Length; i++) { RupeeSaveData save_data; save_data.id = g[i].GetComponent <CurrencyMain>().id; save_data.picked_up = g[i].GetComponent <CurrencyMain>().picked_up; rupees[i] = save_data; } SaveDataScript.save(); // prepare player to leave _player.GetComponent <PlayerController>().enabled = true; _player.gameObject.GetComponent <Collider>().enabled = true; _player.gameObject.GetComponent <PauseMenuScript>().enabled = true; _player.gameObject.transform.Find("Camera").gameObject.SetActive(true); _player.gameObject.transform.Find("spriteU").gameObject.SetActive(true); _player.gameObject.transform.Find("spriteD").gameObject.SetActive(true); _player.gameObject.transform.Find("spriteR").gameObject.SetActive(true); _player.gameObject.transform.Find("spriteL").gameObject.SetActive(true); //DEBUG JUMP PLAYER SO THEY DON'T TELEPORT RIGHT AWAY _player.gameObject.transform.position += new Vector3(1f, 0f, 0f); }
/** * Serialize the map data to disk * @param filename name of the file relative to the "Assets/Resources" folder */ public void saveToDisk(string filename) { var map_color = filename.Substring(0, filename.IndexOf('_')); var map_index = SaveDataScript.map_to_slot(map_color); SaveDataScript.save_data.map_data[map_index] = this; SaveDataScript.save(); /*IFormatter formatter = new BinaryFormatter(); * Stream stream = new FileStream(".\\Assets\\Resources\\" + filename, FileMode.Create, FileAccess.Write, FileShare.None); * formatter.Serialize(stream, this); * stream.Close(); */ }
/** * Save the database to disk * @param filename - name of file on disk */ public void saveToDisk(string filename) { SaveDataScript.save_data.schedule = this; SaveDataScript.save(); }