init
This commit is contained in:
3
Assets/Scripts/Event/EventArgs.meta
Normal file
3
Assets/Scripts/Event/EventArgs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b9504e434a44b2e8917bc39c318fb94
|
||||
timeCreated: 1725859219
|
||||
14
Assets/Scripts/Event/EventArgs/CameraInterActArgs.cs
Normal file
14
Assets/Scripts/Event/EventArgs/CameraInterActArgs.cs
Normal file
@@ -0,0 +1,14 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace Event.EventArgs
|
||||
{
|
||||
public class CameraInterActArgs : System.EventArgs
|
||||
{
|
||||
public GameObject Item { get; }
|
||||
|
||||
public CameraInterActArgs(GameObject item)
|
||||
{
|
||||
Item = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7d7b7ed755c3432eb1ffd466ce229575
|
||||
timeCreated: 1725859232
|
||||
3
Assets/Scripts/Event/EventHandler.meta
Normal file
3
Assets/Scripts/Event/EventHandler.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4cf9fa5509bd4199a7ee9c43efae6a6e
|
||||
timeCreated: 1725859119
|
||||
@@ -0,0 +1,6 @@
|
||||
using Event.EventArgs;
|
||||
|
||||
namespace Event.EventHandler
|
||||
{
|
||||
public delegate void CameraInterActHandler(CameraInterActArgs e);
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e4c03d33ea9c40bf8e045c468a7bc0d9
|
||||
timeCreated: 1725859168
|
||||
42
Assets/Scripts/Event/EventManager.cs
Normal file
42
Assets/Scripts/Event/EventManager.cs
Normal file
@@ -0,0 +1,42 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Event/EventManager.cs.meta
Normal file
3
Assets/Scripts/Event/EventManager.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c6c7b780f301469883211fac6d1fe774
|
||||
timeCreated: 1725858879
|
||||
Reference in New Issue
Block a user