void Awake()
 {
     if (Instance != null)
         Debug.LogError("More than one GameManager in scene.");
     else
         Instance = this;
 }
Пример #2
0
        private void Awake()
        {
            //Check if Instance already exists
            if (Instance == null)
            {
                //if not, set Instance to this
                Instance = this;
            }
            //If Instance already exists and it's not this:
            else
            {
                if (Instance != this)
                {
                    //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one Instance of a GameManager.
                    Destroy(this.gameObject);
                }
            }

            //Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(this.gameObject);

            this._levelManager = this.GetComponent<LevelManager>();
            this._uiManager = this.GetComponent<UIManager>();

            this.InitGame();
        }
Пример #3
0
        void Awake()
        {
            if (Manager != null)
                Destroy(Manager);
            else
                Manager = this;

            DontDestroyOnLoad(this);
        }
Пример #4
0
        void Awake()
        {
            if (Instance == null)
                Instance = this;

            else if (Instance != this)
                Destroy(this);

            DontDestroyOnLoad(gameObject);
        }
Пример #5
0
 //Awake is always called before any Start functions
 void Awake()
 {
     if (Instance == null)
         Instance = this;
     else if (Instance != this)
         Destroy(gameObject);
     DontDestroyOnLoad(gameObject);
     _enemies = new List<Enemy>();
     _boardScript = GetComponent<BoardManager>();
     InitGame();
 }
Пример #6
0
 void Awake()
 {
     Instance = this;
 }
Пример #7
0
		public void Init( )
		{
			m_manager = GameManager.Instance;

			gameObject.SetActive ( true );
		}
Пример #8
0
 //Singleton pattern
 void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Пример #9
0
        //public IOMouseHandler(SubScene subscene) {


        //    m_Subscene = subscene;

        //    m_SceneIndex = m_Subscene.GetIndex();
        //}

        public void Start()
        {
            m_GameManager = GameManager.GetInstance();
        }