示例#1
0
    public void FinishedVerticalMatch()
    {
        finishedVerticalMatch += 1;

        if (finishedVerticalMatch == gridSize)
        {
            if (this.matchedCells.Count > 0)
            {
                this.timesShuffled = 0;
                lastSwap           = null;
                StartCoroutine(DestroyGems());
            }
            else if (lastSwap != null)
            {
                UndoSwap();
            }
            else if (!HasPossibleMovement())
            {
                ShuffleGems();
            }
            else
            {
                SetCanSwap(true);
                showPossibleMoventCoroutine = StartCoroutine(ShowPossibleMovent());
            }
        }
    }
示例#2
0
    public void GetGemsToSwap(int columnIndex, int cellIndex, DirectionEnum direction)
    {
        if (!CanSwap())
        {
            return;
        }

        Cell currentCell = boardGrid[columnIndex, cellIndex];
        Cell nextCell    = GetCell(columnIndex, cellIndex, direction);

        if (currentCell != null && nextCell != null)
        {
            SwapGems(currentCell, nextCell);
            lastSwap = new LastSwap(direction, currentCell, nextCell);
        }
    }
示例#3
0
 void UndoSwap()
 {
     SwapGems(lastSwap.cellOne, lastSwap.cellTwo);
     lastSwap = null;
 }