Files
DougDiggem/Assets/Scripts/GameManager.cs
T

55 lines
1.2 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 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>();
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
public int StarShards = 0; // will replace with inventory system
}
[System.Serializable]
public struct StoryboolSaveData
{
public Storybools Storybools;
}