Scriptum/Assets/Scripts/SaveController.cs

50 lines
1.3 KiB
C#
Raw Normal View History

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);
}
2022-10-02 18:45:58 +02:00
public void SaveHealth()
{
var player = GameObject.FindGameObjectWithTag("Player");
player.GetComponent<Player>().SaveCheckpoint();
}
2022-11-24 03:03:30 +01:00
public void SaveItems() // toDO change name to save Equipment - save items will save items on map eg after drops
{
2022-11-24 03:03:30 +01:00
EquipmentDataManager.Instance.SaveDynamicData();
}
public void SaveQuests()
{
2022-11-27 21:28:55 +01:00
SceneTaskDataManager.Instance.SaveDynamicData();
2022-10-22 18:04:21 +02:00
// right now, we dont need to save dynamic list :D
}
public void SaveInventory()
{
2022-11-27 21:28:55 +01:00
SceneInventoryDataManager.Instance.SaveDynamicData();
}
public void SaveChests()
{
2022-11-24 03:03:30 +01:00
SceneChestDataManager.Instance.SaveDynamicData();
}
}