// Note: If gameObject is not found at first call (in case scene is not fully loaded), this function is called multiple times public override void Init() { this.currentTurn = 1; spawners = GameObject.FindGameObjectsWithTag("Spawner"); if (spawners == null) { return; } if (spawners.Length == 0) { return; } // Instantiate initial pieces foreach (GameObject spawner in spawners) { string pieceName = Pieces.LotPieceName(); spawner.GetComponent <PieceSpawner>().Spawn(pieceName); } // prepare unityads UnityAdsManager.GetInstance(); // unlock pieces Pieces.Instance.UnLock(); // initialize flg this.isInitialized = true; SocialPlatformsManager.Instance.Init(); }
public void ExecPlayerPass() { foreach (GameObject spawner in spawners) { // delete current pieces spawner.GetComponent <PieceSpawner>().DestroyNotMovedPiece(); // create next pieces string pieceName = Pieces.LotPieceName(); spawner.GetComponent <PieceSpawner>().Spawn(pieceName); //Debug.Log(pieceName); } }
public void GoToNextTurn() { bool canSpawn = true; foreach (GameObject spawner in spawners) { if (spawner.GetComponent <PieceSpawner>().CanSpawn() == false) { canSpawn = false; } } if (canSpawn) { foreach (GameObject spawner in spawners) { string pieceName = Pieces.LotPieceName(); spawner.GetComponent <PieceSpawner>().Spawn(pieceName); } } // next turn has come currentTurn++; }