示例#1
0
    private IEnumerator HintRoutine(GameplayCell _hintCell)
    {
        _hintCell.ShowCellWithColor(colorConfiguration.hintColor);
        yield return(new WaitForSeconds(gameplayConfiguration.hintAvailableTime));

        _hintCell.MarkAsQuestion(colorConfiguration.hiddenBlockColor);
    }
示例#2
0
    private void InitializeLevel()
    {
        LevelEditor.SerializableBoard boardToLoad = SerializeUtility.LoardBoardFromFile(m_levelToLoad);
        m_boardGridLayoutPanel.constraintCount = boardToLoad.boardSize;

        // Instantiating all cells
        foreach (LevelEditor.SerializableCell cell in boardToLoad.serializableGrid)
        {
            GameplayCell gameplayCell = Instantiate(gameplayCellPrefab, gridPanel.transform).GetComponent <GameplayCell>();
            gameplayCell.FetchDependencies();
            gameplayCell.Assign(cell, colorConfiguration);

            // see if it would be a hint or answer, and then do stuff...
            if (cell.cellType == (int)LevelEditor.CellScript.ECellType.Unused)
            {
                m_unusedCells.Add(gameplayCell);
            }
            else if (cell.cellStatus == (int)LevelEditor.CellScript.ECellStatus.Hidden)
            {
                gameplayCell.MarkAsQuestion(colorConfiguration.hiddenBlockColor);
                m_questionCells.Add(gameplayCell);

                // Instantiating the cell that will be shown on the answer bank and can be dragged
                GameplayCell answerCell = Instantiate(gameplayCellPrefab, solutionBank.transform).GetComponent <GameplayCell>();
                answerCell.FetchDependencies();
                answerCell.Assign(cell, colorConfiguration);

                // Adding the Drag Component and stablishing all the actions necessary
                CellDrag answerCellDragComponent = answerCell.gameObject.AddComponent <CellDrag>();
                answerCellDragComponent.OnInteractedWithCell += GiveFeedbackOnCell;
                answerCellDragComponent.OnCellWasMatched     += RemoveCellFromAnswers;

                answerCell.MarkAsAnswer();
                m_answerCells.Add(answerCell);
            }
            else if (cell.cellStatus == (int)LevelEditor.CellScript.ECellStatus.Visible)
            {
                gameplayCell.cellType = GameplayCell.ECellType.Hint;
                m_gameplayCells.Add(gameplayCell);
            }
        }

        m_feedbackUIReference.UpdateRemainingUIText(m_answerCells.Count);
    }