void Awake()
 {
     if (Instance != null)
         Debug.LogError("More than one GameManager in scene.");
     else
         Instance = this;
 }
Esempio n. 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();
        }
Esempio n. 3
0
        void Awake()
        {
            if (Manager != null)
                Destroy(Manager);
            else
                Manager = this;

            DontDestroyOnLoad(this);
        }
Esempio n. 4
0
        void Awake()
        {
            if (Instance == null)
                Instance = this;

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

            DontDestroyOnLoad(gameObject);
        }
Esempio n. 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();
 }
Esempio n. 6
0
 void Awake()
 {
     Instance = this;
 }
Esempio n. 7
0
File: Menu.cs Progetto: mahnovsky/PT
		public void Init( )
		{
			m_manager = GameManager.Instance;

			gameObject.SetActive ( true );
		}
Esempio n. 8
0
 //Singleton pattern
 void Awake()
 {
     if (!instance)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
        //public IOMouseHandler(SubScene subscene) {


        //    m_Subscene = subscene;

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

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