Scriptum/Assets/Scripts/SaveController.cs
2022-11-28 00:52:47 +01:00

50 lines
1.3 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);
}
public void LoadScene()
{
OnMapAppearanceMethod.Gateway = OnMapAppearanceMethodEnum.LoadGame;
string sceneToGoTo = PlayerPrefs.GetString("SceneSaved");
SceneManager.LoadScene(sceneToGoTo);
}
public void SaveHealth()
{
var player = GameObject.FindGameObjectWithTag("Player");
player.GetComponent<Player>().SaveCheckpoint();
}
public void SaveItems() // toDO change name to save Equipment - save items will save items on map eg after drops
{
EquipmentDataManager.Instance.SaveDynamicData();
}
public void SaveQuests()
{
SceneTaskDataManager.Instance.SaveDynamicData();
// right now, we dont need to save dynamic list :D
}
public void SaveInventory()
{
SceneInventoryDataManager.Instance.SaveDynamicData();
}
public void SaveChests()
{
SceneChestDataManager.Instance.SaveDynamicData();
}
}