Beispiel #1
0
        private void Awake()
        {
            if (_instance != null)
            {
                Destroy(this);
                return;
            }
            _instance = this;

            if (!_isInitialized)
            {
                initialize();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Доступ к контролеру
        /// </summary>
        /// <returns>Экземпляр игрового контроллера</returns>
        public static CGameController Instance()
        {
            if (_instance == null)
            {
                _instance = FindObjectOfType <CGameController>();
                if (_instance == null)
                {
                    _instance = new GameObject().AddComponent <CGameController>();
                }
            }

            if (!_instance._isInitialized)
            {
                _instance.initialize();
            }

            return(_instance);
        }