//액션(게임 진행 버튼) public void OnActionButtonTouched() { Cube.CurrentCube.Stop(); cubeGenerator.GenerateCube(); GameManager.instance.calcScore(); if (GameManager.instance.Stack >= 20) { GameManager.instance.eyeUP(); } }
/// <summary> /// This function will create cubes wall based game configs, and update game state flags./ /// Note: this function implemented to allow being called from coroutine, because between each cube creation we wait small fraction. /// </summary> public IEnumerator CreateCubesWall() { // reset flags and cubes matrix. Reset(); IsDoneCreatingCubes = false; // this is checked by GameManager Update() function. when false, Update() skips. // simply iterate over width and height indexes and create cubes using CubeGenerator. for (uint row = 0; row < GameManager.Instance.GameConfigs.BoardHeight; ++row) { for (uint col = 0; col < GameManager.Instance.GameConfigs.BoardWidth; ++col) { GameObject newCube = cubeGenerator.GenerateCube(col, row); this.cubesMatrix[col, row] = newCube; yield return(new WaitForSeconds(TIME_TO_WAIT_BETWEEN_CUBES_CREATION)); } } IsDoneCreatingCubes = true; IsGameStartedFirstTime = true; //only set once. no changing back later. }