Scriptum/Assets/Scripts/SaveController.cs

43 lines
1.0 KiB
C#
Raw Permalink 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();
}
public void SaveItems()
{
SceneEquippableItemManager.Instance.SaveEquippableItems();
}
public void SaveQuests()
{
SceneTaskManager.Instance.SaveQuests();
}
public void SaveInventory()
{
SceneInventoryManager.Instance.SaveInventoryItems();
}
}