//Awake is always called before any Start functions
    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(gameObject);
        }

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

        //Get a component reference to the attached BoardManager script
        boardmanager = GameObject.FindGameObjectWithTag("BoardManagerTag").GetComponent <BoardManager>();
        while (gamePool == null)
        {
            gamePool = GetComponent <PoolScript>();
        }
        //player1 = GetComponent<PlayerManager>();


        //Call the InitGame function to initialize the first level
        InitGame();
    }
 private void Awake()
 {
     Instance = this;
 }
Пример #3
0
 void Awake()
 {
     current = this;
 }
Пример #4
0
 void Awake()
 {
     instance=this;
 }
Пример #5
0
 void Start()
 {
     instance = this;
     CheckForDuplicatePoolNames();
     CreatePools();
 }