public void findAndRemoveMatches() { // формируем список линий ArrayList matches = lookMatches(); for (int i = 0; i < matches.Count; i++) { ArrayList item = (ArrayList)matches[i]; int numPoints = (item.Count - 1) * 25; for (int j = 0; j < item.Count; j++) { if (item[j] != null) { GameObject gem = (GameObject)item[j]; Gem gemClass = gem.GetComponent <Gem>(); PopupScore.getInstance().AddPopupScore(new Vector3(gem.transform.position.x, gem.transform.position.y, -2), numPoints); Debug.Log("Destroy gem " + gemClass.col + " " + gemClass.row); gemClass.destroyed = true; gemsBoard[gemClass.col, gemClass.row] = null; _matches.Add(new int[2] { gemClass.col, gemClass.row }); } } } //addNewPieces(); }
void Awake() { gems = Resources.LoadAll("Gems"); PopupScore.getInstance().initTarget(gameObject); gemsBoard = new GameObject[countX, countY]; CreateField(); CreateBoard(); }