Exemplo n.º 1
0
    private IEnumerator SwapTilesRoutine(GemBehaviour gemA, GemBehaviour gemB)
    {
        var indexA = gemA.Index.Clone();
        var indexB = gemB.Index.Clone();

        gemA.Move(indexB, SequenceParameters.GemMoveTime);
        gemB.Move(indexA, SequenceParameters.GemMoveTime);

        yield return(new WaitForSeconds(SequenceParameters.GemMoveTime));

        var matches =
            GridManager.FindMatchesAt(indexA)
            .Union(GridManager.FindMatchesAt(indexB));


        if (matches.Any())
        {
            yield return(new WaitForSeconds(SequenceParameters.PlayerMatchCheckDelay));

            ClearAndRefillBoard(matches);
        }
        else
        {
            gemA.Move(indexA, SequenceParameters.GemMoveTime);
            gemB.Move(indexB, SequenceParameters.GemMoveTime);
        }
    }
Exemplo n.º 2
0
        private GemBehaviour MakeGemFall(GemBehaviour gem, int xIndex, int initY, int newY)
        {
            var index = new GridIndex(xIndex, newY);

            gem.Move(index, gemFallSpeed * (initY - newY));

            SetGemPosition(gem, index);

            allGems[xIndex, initY] = null;
            return(gem);
        }