public void InstantiateTimeStar() { int row; int collumn; do { row = Random.Range(0, countCollumn); collumn = Random.Range(0, countRow); //if (arrGem[row][collumn] == null || arrGem[row][collumn].GetComponent<Gem>().timeAdd == true) //{ // row = Random.Range(0, countCollumn); // collumn = Random.Range(0, countRow); //} } while (arrGem[row][collumn] == null || arrGem[row][collumn].GetComponent <Gem>().timeAdd == true); if (arrGem[row][collumn] != null) { GameObject a = Instantiate(timeStar, tranfsIn.position, Quaternion.identity) as GameObject; a.GetComponent <Gem>().MovePositionStar(arrGem[row][collumn].transform.position, 1.0f); a.transform.parent = arrGem[row][collumn].transform; //a.transform.parent = gemContainer; a.transform.localScale = Vector3.one; Gem gem = arrGem[row][collumn].GetComponent <Gem>(); TimeAdd t = a.GetComponent <TimeAdd>(); if (gem != null) { gem.timeAdd = true; gem.addTimeGame = uiController.timeAddValue; uiController.timeAddValue = 0; if (!listGemAddTime.Contains(gem)) { listGemAddTime.Add(gem); } if (t != null) { t.textTime.text = gem.addTimeGame.ToString(); } } activeAddtime = false; } }
public void CheckCombo() { if (countGem >= 10) { countCombo += 1; } if (countGem < 10) { countCombo = 0; } List <Gem> listGem = gameController.listGemAddTime; if (listGem != null) { for (int i = 0; i < gameController.listGemAddTime.Count; i++) { if (listGem[i].addTimeGame > 4) { listGem[i].addTimeGame -= 1; } for (int j = 0; j < listGem[i].gameObject.transform.GetChildCount(); j++) { GameObject tObj = listGem[i].transform.GetChild(j).gameObject; if (tObj != null) { TimeAdd t = tObj.GetComponent <TimeAdd>(); if (t != null) { t.textTime.text = listGem[i].addTimeGame.ToString(); } } } } } //Debug.Log("Count Combo = " + countCombo); }