48 lines
1.2 KiB
C#
48 lines
1.2 KiB
C#
using Event.EventArgs;
|
|
using Event.EventHandler;
|
|
using UnityEngine;
|
|
|
|
namespace Event
|
|
{
|
|
public class EventManager : MonoBehaviour
|
|
{
|
|
private static EventManager _instance;
|
|
|
|
public static EventManager Instance
|
|
{
|
|
get
|
|
{
|
|
if (_instance)
|
|
return _instance;
|
|
_instance = FindObjectOfType<EventManager>() ??
|
|
new GameObject("EventManager").AddComponent<EventManager>();
|
|
return _instance;
|
|
}
|
|
}
|
|
|
|
private void Awake()
|
|
{
|
|
if (_instance != null && _instance != this)
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
else
|
|
{
|
|
_instance = this;
|
|
}
|
|
}
|
|
|
|
public event CameraInterActHandler CameraInterAct;
|
|
public event DialogPopHandler DialogPop;
|
|
|
|
public void OnCameraInterAct(GameObject item)
|
|
{
|
|
CameraInterAct?.Invoke(new CameraInterActArgs(item));
|
|
}
|
|
|
|
public void OnDialogPop(int index)
|
|
{
|
|
DialogPop?.Invoke(new DialogPopArgs(index));
|
|
}
|
|
}
|
|
} |