Example #1
0
    private bool PlayEffectsStep()
    {
        BoardElement lastElementProcessed   = secondElement;
        bool         areThereChangesOnBoard = false;

        for (int row = 0; row < elementsPositions.GetLength(1); row++)
        {
            for (int collum = 0; collum < elementsPositions.GetLength(0); collum++)
            {
                if (matchedElemPositions[collum, row] == true)
                {
                    BoardFunctions.PlayMatchEffectAnimations(collum, row, this);
                    if (BoardFunctions.DestroyBoardElement(collum, row, this, lastElementProcessed))
                    {
                        areThereChangesOnBoard = true;
                    }
                }
                lastElementProcessed = elementsPositions[collum, row];
                BoardFunctions.ToggleHighlightCell(collum, row, this, false);
            }
        }

        if (!areThereChangesOnBoard)
        {
            AlexDebugger.GetInstance().AddMessage("Step2 finished: -play effects for matched elements-, go to Step3: -reorient elements- " + messagesToClient.Count, AlexDebugger.tags.Step2);
            return(true);
        }
        else
        {
            AlexDebugger.GetInstance().AddMessage("Step2 finished: -play effects for matched elements-, new elements has been destroyed, repeating step ", AlexDebugger.tags.Step2);
            return(false);
        }
    }