/// <summary> /// Счетчик уровня сложности игры /// </summary> protected void UpdateLevel() { _ModelGO = GameObject.Find(_sceneName); if (_ModelGO != null) { _levelTxt = _ModelGO.GetComponent <GameGridData>(); } levelText = _levelTxt._levelText; levelText.text = "Level: " + curLevel.ToString(); if (curScore == Mathf.Clamp(curScore, 11, 20)) { curLevel = Level_2; speedFull = speedLevel_2; } else if (curScore == Mathf.Clamp(curScore, 21, 30)) { curLevel = Level_3; speedFull = speedLevel_3; } else if (curScore == Mathf.Clamp(curScore, 41, 50)) { curLevel = Level_4; speedFull = speedLevel_4; } else if (curScore == Mathf.Clamp(curScore, 51, 60)) { curLevel = Level_5; speedFull = speedLevel_5; } else if (curScore == Mathf.Clamp(curScore, 61, 70)) { curLevel = Level_6; speedFull = speedLevel_6; } else if (curScore == Mathf.Clamp(curScore, 71, 80)) { curLevel = Level_7; speedFull = speedLevel_7; } else if (curScore == Mathf.Clamp(curScore, 81, 90)) { curLevel = Level_8; speedFull = speedLevel_8; } else if (curScore == Mathf.Clamp(curScore, 91, 100)) { curLevel = Level_9; speedFull = speedLevel_9; } }
/// <summary> /// Инициализирует игровую модель и генерирует методом случайного выбора модель для следующей инициализации /// </summary> /// <returns></returns> protected override IEnumerator LoadSceneData(AsyncOperation op) { yield return(base.LoadSceneData(op)); _ModelGO = GameObject.Find(_sceneName); if (_ModelGO != null) { _curModels = _ModelGO.GetComponent <GameGridData>(); _nextTexture = _ModelGO.GetComponent <GameGridData>(); _rawImg = _ModelGO.GetComponent <GameGridData>(); } curMod = _curModels._models[Random.Range(0, _curModels._models.Length)]; UnityEngine.GameObject.Instantiate(curMod, instPos, Quaternion.identity); nextTex = _nextTexture._modelsTex[Random.Range(0, _nextTexture._modelsTex.Length)]; rawImg = _rawImg._rawImg; rawImg.texture = nextTex; }
/// <summary> /// Счетчик полученых очков за удаление ряда и кол-во удаленных рядов /// </summary> protected void UpdateScore() { _ModelGO = GameObject.Find(_sceneName); if (_ModelGO != null) { _scoreTxt = _ModelGO.GetComponent <GameGridData>(); _lineTxt = _ModelGO.GetComponent <GameGridData>(); } scoreText = _scoreTxt._scoreText; lineText = _lineTxt._lineText; lineText.text = "Lines: " + curLine.ToString(); scoreText.text = "Score: " + curScore.ToString(); if (countRow > 0) { if (countRow == Row_1) { curScore += scoreOneLine; curLine += countRow; } else if (countRow == Row_2) { curScore += scoreTwoLine; curLine += countRow; } else if (countRow == Row_3) { curScore += scoerThreeLine; curLine += countRow; } else if (countRow == Row_4) { curScore += scoerThreeLine; curLine += countRow; } } countRow = 0; }