Files
AppleHillsProduction/Assets/Scripts/GameManager.cs

37 lines
999 B
C#

using UnityEngine;
public class GameManager : MonoBehaviour
{
private static GameManager _instance;
public static GameManager Instance
{
get
{
if (_instance == null)
{
_instance = FindAnyObjectByType<GameManager>();
if (_instance == null)
{
var go = new GameObject("GameManager");
_instance = go.AddComponent<GameManager>();
DontDestroyOnLoad(go);
}
}
return _instance;
}
}
[Header("Game Settings")]
public GameSettings gameSettings;
void Awake()
{
_instance = this;
DontDestroyOnLoad(gameObject);
}
public float PlayerStopDistance => gameSettings != null ? gameSettings.playerStopDistance : 1.0f;
public float FollowerPickupDelay => gameSettings != null ? gameSettings.followerPickupDelay : 0.2f;
// Add more accessors as needed
}