diff --git a/Assets/Scripts/Events/EventController.cs b/Assets/Scripts/Events/EventController.cs index da1926b4..252b8f6a 100644 --- a/Assets/Scripts/Events/EventController.cs +++ b/Assets/Scripts/Events/EventController.cs @@ -8,3 +8,11 @@ public class EventController public void InvokeEvent() => baseEvent?.Invoke(); } +public class EventController // generic class +{ + public Action baseEvent; + public void AddListener(Action listener) => baseEvent += listener; + public void RemoveListener(Action listener) => baseEvent -= listener; + public void InvokeEvent(T type) => baseEvent?.Invoke(type); +} + diff --git a/Assets/Scripts/Service/EventService.cs b/Assets/Scripts/Service/EventService.cs index fb22c2b5..2bd4f9c9 100644 --- a/Assets/Scripts/Service/EventService.cs +++ b/Assets/Scripts/Service/EventService.cs @@ -13,8 +13,25 @@ public static EventService Instance return instance; } } + + //int x = 5; + //public int getx() + //{ + // return x; + //} + + //public void setx(int value) + //{ + // x = value; + + //} + + //public int X { get { return x; } private set { x = value; } } + + //public int X { get;private set; } public EventController OnLightSwitchToggled { get; private set; } + public EventController OnKeyPickedUp { get; private set; } public EventService() {