Exemple #1
0
    private void CheckAndRemoveLinesInField()
    {
        ArrayList indicesOfRemovedLines = new ArrayList();
        bool      doRemoveLine          = true;
        int       index = 0;

        for (int i = 0; i < HEIGHT; i++)
        {
            doRemoveLine = true;
            for (int j = 0; j < WIDTH; j++)
            {
                index = i * WIDTH + j;
                if (fieldPattern[index] == 0)
                {
                    doRemoveLine = false;
                    break;
                }
            }

            if (doRemoveLine)
            {
                for (int j = 0; j < WIDTH; j++)
                {
                    index = i * WIDTH + j;
                    cubeController.ReturnCubeToPool(cubesInFieldPattern[index]);
                    fieldPattern[index] = 0;
                }

                indicesOfRemovedLines.Add(i);
            }
        }

        if (indicesOfRemovedLines.Count > 0)
        {
            CompressFieldPattern(indicesOfRemovedLines);
        }
    }