56 lines
1.3 KiB
C#
56 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class GameManager : MonoBehaviour
|
|
{
|
|
public static GameManager Instance { get; private set; }
|
|
public DialogueManager DialogueManager { get; private set; }
|
|
public Inventory Inventory { get; private set; }
|
|
public Storybools Storybools { get; private set; }
|
|
|
|
private void Awake()
|
|
{
|
|
// If there is an instance, and it's not me, delete myself.
|
|
|
|
if (Instance != null && Instance != this)
|
|
{
|
|
Destroy(this);
|
|
}
|
|
else
|
|
{
|
|
Instance = this;
|
|
DontDestroyOnLoad(gameObject);
|
|
|
|
DialogueManager = GetComponent<DialogueManager>();
|
|
Inventory = GetComponent<Inventory>();
|
|
|
|
SaveSystem.Load();
|
|
}
|
|
}
|
|
|
|
#region Storybool Save/Load
|
|
public void SaveStoryBools(ref StoryboolSaveData data)
|
|
{
|
|
data.Storybools = Instance.Storybools;
|
|
}
|
|
|
|
public void LoadStoryBools(StoryboolSaveData data)
|
|
{
|
|
if (data.Storybools != null)
|
|
{
|
|
Instance.Storybools = data.Storybools;
|
|
}
|
|
else
|
|
{
|
|
Instance.Storybools = new Storybools();
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
[System.Serializable]
|
|
public struct StoryboolSaveData
|
|
{
|
|
public Storybools Storybools;
|
|
}
|