42 lines
1012 B
C#
42 lines
1012 B
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 void OnCameraInterAct(GameObject item)
|
|
{
|
|
CameraInterAct?.Invoke(new CameraInterActArgs(item));
|
|
}
|
|
}
|
|
} |