Scriptum/Assets/Scripts/SaveController.cs
2022-12-06 01:27:02 +01:00

54 lines
1.5 KiB
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SaveController : MonoBehaviour
{
public void SaveScene()
{
string activeScene = SceneManager.GetActiveScene().name;
PlayerPrefs.SetString("SceneSaved", activeScene);
}
/// <summary>
/// Used only in 'MainMenu' scene in 'Contine' button
/// </summary>
public void LoadScene()
{
string sceneToGoTo = PlayerPrefs.GetString("SceneSaved");
SceneManager.LoadScene(sceneToGoTo);
}
public void SaveHealth()
{
var player = GameObject.FindGameObjectWithTag("Player");
player.GetComponent<Player>().SaveCheckpoint();
}
public void SavePlayerEquipmentItems() // toDO change name to save Equipment - save items will save items on map eg after drops
{
EquipmentDataManager.Instance.SaveDynamicData();
}
public void SavePlayerQuests()
{
SceneTaskDataManager.Instance.SaveDynamicData();
// right now, we dont need to save dynamic list :D
}
public void SavePlayerInventory()
{
SceneInventoryDataManager.Instance.SaveDynamicData();
}
public void SaveChests()
{
// there may be mapos where we dont have this elements because we dont want to have there any chests - simple
// eg Cave Entrance
if(SceneChestDataManager.Instance)
SceneChestDataManager.Instance.SaveDynamicData();
}
}