64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using System.Resources;
|
|
using UnityEngine;
|
|
|
|
public class Managers : MonoBehaviour
|
|
{
|
|
static Managers s_instance;
|
|
static Managers Instance { get { init(); return s_instance; } }
|
|
|
|
InputManager _input = new InputManager();
|
|
PoolManager _pool = new PoolManager();
|
|
ResourceManager _resource = new ResourceManager();
|
|
SceneManagerEx _scene = new SceneManagerEx();
|
|
SoundManager _sound = new SoundManager();
|
|
UIManager _ui = new UIManager();
|
|
public static InputManager Input { get { return Instance._input; } }
|
|
public static PoolManager Pool { get { return Instance._pool; } }
|
|
public static ResourceManager Resource { get { return Instance._resource; } }
|
|
public static SceneManagerEx Scene { get { return Instance._scene; } }
|
|
public static SoundManager Sound { get { return Instance._sound; } }
|
|
public static UIManager UI { get { return Instance._ui; } }
|
|
|
|
|
|
static void init()
|
|
{
|
|
if (s_instance == null)
|
|
{
|
|
GameObject obj = GameObject.Find("@Managers");
|
|
if (obj == null)
|
|
{
|
|
obj = new GameObject { name = "@Managers" };
|
|
obj.AddComponent<Managers>();
|
|
}
|
|
DontDestroyOnLoad(obj);
|
|
s_instance = obj.GetComponent<Managers>();
|
|
|
|
s_instance._pool.Init();
|
|
s_instance._sound.Init();
|
|
|
|
}
|
|
}
|
|
|
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
|
void Start()
|
|
{
|
|
init();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update()
|
|
{
|
|
_input.OnUpdate();
|
|
}
|
|
|
|
public static void Clear()
|
|
{
|
|
Input.Clear();
|
|
Sound.Clear();
|
|
Scene.Clear();
|
|
UI.Clear();
|
|
|
|
Pool.Clear();
|
|
}
|
|
}
|