This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| using System.Collections.Generic; | |
| using UnityEngine; | |
| public static class EventBus | |
| { | |
| private static readonly Dictionary<Type, List<Delegate>> _eventHandlers = new Dictionary<Type, List<Delegate>>(); | |
| // Subscribe to an event | |
| public static void Subscribe<T>(Action<T> handler) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class GameManager : MonoBehaviour | |
| { | |
| public static GameManager Instance; | |
| private void Awake() | |
| { | |
| if (Instance == null) | |
| { | |
| Instance = this; | |
| DontDestroyOnLoad(gameObject); |