Exemple #1
0
        public static GameSingletonManagers Get()
        {
            if (Instance == null)
            {
                Instance = new GameSingletonManagers();
            }

            return(Instance);
        }
Exemple #2
0
        public static T Get()
        {
            if (Instance == null)
            {
                Instance = new T();
                GameSingletonManagers.Get().OnGameSingletonCreated(Instance);
            }

            return(Instance);
        }
Exemple #3
0
        public void OnDestroy()
        {
            for (var i = this.AllGameSingletons.Count - 1; i >= 0; i--)
            {
                var gameSingleton = this.AllGameSingletons[i];
                if (gameSingleton != null)
                {
                    gameSingleton.OnDestroy();
                }
            }

            Instance = null;
        }
Exemple #4
0
        public void OnDestroy()
        {
            for (var i = this.AllGameSingletons.Count - 1; i >= 0; i--)
            {
                var gameSingleton = this.AllGameSingletons[i];
                if (gameSingleton != null)
                {
                    /// First calling the destroy callback
                    gameSingleton.OnDestroy();

                    /// Unreferencing the singleton instance so that a new one is created on load
                    gameSingleton.ClearInstance();
                }
            }

            Instance = null;
        }