예제 #1
0
    void CreateLevelStage()
    {
        switch (levelStage)
        {
        case 0:
            for (int x = 0; x < 7; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    float positionX = x * 70.0f - 210.0f;
                    float positionY = y * 40.0f + 162.0f;
                    int   colorCode = x;
                    prefabCreator.CreateNormalBlock(positionX, positionY, colorCode);
                }
            }
            break;

        case 1:
            for (int x = 0; x < 7; x++)
            {
                int[] numberOfBlocks = { 1, 2, 3, 4, 3, 2, 1 };
                for (int y = 0; y < numberOfBlocks[x]; y++)
                {
                    float[] positionsPy = { 160.0f, 140.0f, 120.0f, 100.0f, 120.0f, 140.0f, 160.0f };
                    float   positionX   = x * 100.0f - 300.0f;
                    float   positionY   = y * 40.0f + positionsPy[x];
                    prefabCreator.CreateHardBlock(positionX, positionY);
                }
            }
            break;

        case 2:
            for (int i = 0; i < 7; i++)
            {
                for (int x = 0; x < 5; x++)
                {
                    for (int y = 0; y < 3; y++)
                    {
                        int[,] pattern = { { 0, 0, 1 }, { 0, 1, 1 }, { 1, 1, 1 }, { 0, 1, 1 }, { 0, 0, 1 } };
                        float positionX = x * 20.0f + i * 120.0f - 400.0f;
                        float positionY = y * 20.0f + 222.0f;
                        int   colorCode = i;
                        if (pattern[x, y] == 1)
                        {
                            prefabCreator.CreateSmallBlock(positionX, positionY, colorCode);
                        }
                    }
                }
            }
            break;

        case 3:
            for (int i = 0; i < 7; i++)
            {
                float[] positionXs = { 40.0f, 120.0f, 198.0f, 265.0f, 309.0f, 325.0f, 325.0f };
                float[] positionYs = { -45.0f, -45.0f, -29.0f, 15.0f, 82.0f, 160.0f, 240.0f };
                float   positionX1 = positionXs[i];
                float   positionX2 = -positionXs[i];
                float   positionY  = positionYs[i];
                int     colorCode  = i;
                prefabCreator.CreateRoundBlock(positionX1, positionY, colorCode);
                prefabCreator.CreateRoundBlock(positionX2, positionY, colorCode);
            }
            break;

        case 4:
            for (int x = 0; x < 7; x++)
            {
                float positionXn  = x * 120.0f - 360.0f;
                float positionXs1 = x * 120.0f - 340.0f;
                float positionXs2 = x * 120.0f - 360.0f;
                float positionXs3 = x * 120.0f - 380.0f;
                float positionXr  = x * 120.0f - 360.0f;
                float positionYn1 = 0.0f;
                float positionYn2 = 200.0f;
                float positionYs1 = 50.0f;
                float positionYs2 = 150.0f;
                float positionYr  = 100.0f;
                int   colorCode   = 6 - x;
                prefabCreator.CreateNormalBlock(positionXn, positionYn1, colorCode);
                prefabCreator.CreateNormalBlock(positionXn, positionYn2, colorCode);
                prefabCreator.CreateSmallBlock(positionXs1, positionYs1, colorCode);
                prefabCreator.CreateSmallBlock(positionXs2, positionYs1, colorCode);
                prefabCreator.CreateSmallBlock(positionXs3, positionYs1, colorCode);
                prefabCreator.CreateSmallBlock(positionXs1, positionYs2, colorCode);
                prefabCreator.CreateSmallBlock(positionXs2, positionYs2, colorCode);
                prefabCreator.CreateSmallBlock(positionXs3, positionYs2, colorCode);
                prefabCreator.CreateRoundBlock(positionXr, positionYr, colorCode);
            }
            for (int y = 0; y < 5; y++)
            {
                float positionX1 = -450.0f;
                float positionX2 = 450.0f;
                float positionY  = y * 40.0f + 20.0f;
                prefabCreator.CreateHardBlock(positionX1, positionY);
                prefabCreator.CreateHardBlock(positionX2, positionY);
            }
            break;

        case 5:
            for (int x = 0; x < 15; x++)
            {
                int[] blockCode = { 0, 1, 0, 2, 0, 3, 0, 4, 0, 5, 0, 6, 0, 7, 0 };
                float positionX = x * 50.0f - 350.0f;
                float positionY = 262.0f;
                switch (blockCode[x])
                {
                case 0:
                    prefabCreator.CreateSilverBlock(positionX, positionY);
                    break;

                case 1:
                    prefabCreator.CreateItemBlock(positionX, positionY, 8);
                    break;

                case 2:
                    prefabCreator.CreateItemBlock(positionX, positionY, 9);
                    break;

                case 3:
                    prefabCreator.CreateItemBlock(positionX, positionY, 11);
                    break;

                case 4:
                    prefabCreator.CreateItemBlock(positionX, positionY, 13);
                    break;

                case 5:
                    prefabCreator.CreateItemBlock(positionX, positionY, 14);
                    break;

                case 6:
                    prefabCreator.CreateItemBlock(positionX, positionY, 19);
                    break;

                case 7:
                    prefabCreator.CreateItemBlock(positionX, positionY, 20);
                    break;
                }
            }
            break;

        case 6:

            for (int x = 0; x < 36; x++)
            {
                for (int y = 0; y < 7; y++)
                {
                    int[,] pattern =
                    {
                        { 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
                        { 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
                        { 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
                        { 1, 1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1 },
                        { 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 },
                        { 1, 0, 1, 0, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 },
                        { 1, 0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1 },
                    };
                    float positionX = x * 20.0f - 350.0f;
                    float positionY = y * -20.0f + 200.0f;
                    int   colorCode = y;
                    if (pattern[y, x] == 1)
                    {
                        prefabCreator.CreateSmallBlock(positionX, positionY, colorCode);
                    }
                }
            }
            break;

        case 7:
            for (int x = 0; x < 7; x++)
            {
                float positionX   = x * 140.0f - 420.0f;
                float positionY1  = 100.0f;
                float positionY2  = 200.0f;
                int   colorCode   = x;
                int   breakCount1 = 5;
                int   breakCount2 = 10;
                prefabCreator.CreateCountBlock(positionX, positionY1, colorCode, breakCount1);
                prefabCreator.CreateCountBlock(positionX, positionY2, colorCode, breakCount2);
            }

            break;
        }
    }
예제 #2
0
    void CreateLevelStage()
    {
        switch (levelStage)
        {
        case 0:
            for (int i = 0; i < 2; i++)
            {
                for (int x = 0; x < 7; x++)
                {
                    for (int y = 0; y < 4; y++)
                    {
                        float positionX = x * 50.0f + i * 450.0f - 375.0f;
                        float positionY = y * 20.0f + 122.0f;
                        int   colorCode = x;
                        prefabCreator.CreateNormalBlock(positionX, positionY, colorCode);
                    }
                }
            }
            for (int x = 0; x < 3; x++)
            {
                float positionX = x * 450.0f - 450.0f;
                float positionY = 182.0f;
                prefabCreator.CreateItemBlock(positionX, positionY, 8);
            }
            break;

        case 1:
            for (int x = 0; x < 12; x++)
            {
                float positionX = x * 80.0f - 440.0f;
                float positionY = 157.0f;
                prefabCreator.CreateHardRoundBlock(positionX, positionY);
            }
            for (int x = 0; x < 20; x++)
            {
                float positionX = x * 50.0f - 475.0f;
                float positionY = 112.0f;
                prefabCreator.CreateHardBlock(positionX, positionY);
            }
            break;

        case 2:
            int baseColorCodeForPhase2 = Random.Range(0, 7);
            for (int x = 0; x < 50; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    float positionX = x * 20.0f - 490.0f;
                    float positionY = y * 20.0f + 142.0f;
                    int   colorCode = (baseColorCodeForPhase2 + x + 7 - y) % 7;
                    prefabCreator.CreateSmallBlock(positionX, positionY, colorCode);
                }
            }

            prefabCreator.CreateItemBlock(-200.0f, 80.0f, 8);
            prefabCreator.CreateItemBlock(0.0f, 80.0f, 9);
            prefabCreator.CreateItemBlock(200.0f, 80.0f, 8);

            break;

        case 3:
            for (int x = 0; x < 7; x++)
            {
                for (int y = 0; y < 3; y++)
                {
                    float positionX = x * 140.0f - 420.0f;
                    float positionY = y * 20.0f + 142.0f;
                    int   colorCode = x;
                    prefabCreator.CreateCountBlock(positionX, positionY, colorCode, 10);
                }
            }
            for (int x = 0; x < 6; x++)
            {
                float positionX = x * 140.0f - 350.0f;
                float positionY = 182.0f;
                prefabCreator.CreateItemBlock(positionX, positionY, 14);
            }
            break;

        case 4:
            int baseColorCodeForPhase4a = Random.Range(0, 7);
            int baseColorCodeForPhase4b = Random.Range(0, 7);
            for (int x = 0; x < 16; x++)
            {
                float positionX = x * 60.0f - 455.0f;
                float positionY = 154.0f;
                int   colorCode = (baseColorCodeForPhase4a + x + 1) % 7;
                prefabCreator.CreateRoundBlock(positionX, positionY, colorCode);
            }
            for (int x = 0; x < 15; x++)
            {
                float positionX = x * 60.0f - 425.0f;
                float positionY = 102.0f;
                int   colorCode = (baseColorCodeForPhase4a + x + 1) % 7;
                prefabCreator.CreateRoundBlock(positionX, positionY, colorCode);
            }
            for (int x = 0; x < 16; x++)
            {
                float positionX = x * 60.0f - 455.0f;
                float positionY = 50.0f;
                int   colorCode = (baseColorCodeForPhase4a + x) % 7;
                prefabCreator.CreateRoundBlock(positionX, positionY, colorCode);
            }
            for (int x = 0; x < 50; x++)
            {
                float positionX = x * 20.0f - 490.0f;
                float positionY = 0.0f;
                int   colorCode = (baseColorCodeForPhase4b + x) % 7;
                prefabCreator.CreateSmallBlock(positionX, positionY, colorCode);
            }
            break;

        case 5:
            for (int i = 0; i < 4; i++)
            {
                for (int x = 0; x < 3; x++)
                {
                    for (int y = 0; y < 3; y++)
                    {
                        int[,] pattern = { { 1, 0, 1 }, { 0, 2, 0 }, { 1, 0, 1 } };
                        float positionX = i * 200.0f + x * 50.0f - 350.0f;
                        float positionY = y * 20.0f + 120.0f;
                        switch (pattern[x, y])
                        {
                        case 0:
                            prefabCreator.CreateNormalBlock(positionX, positionY, 1);
                            break;

                        case 1:
                            prefabCreator.CreateNormalBlock(positionX, positionY, 0);
                            break;

                        case 2:
                            prefabCreator.CreateItemBlock(positionX, positionY, 21);
                            break;
                        }
                    }
                }
            }
            break;

        case 6:
            for (int x = 0; x < 6; x++)
            {
                float positionX = x * 140.0f - 350.0f;
                float positionY = 140.0f;
                prefabCreator.CreateFlashBlock(positionX, positionY);
            }
            for (int x = 0; x < 7; x++)
            {
                float positionX = x * 140.0f - 420.0f;
                float positionY = 140.0f;
                int   itemCode  = x % 2 == 0 ? 11 : 9;
                prefabCreator.CreateItemBlock(positionX, positionY, itemCode);
            }
            break;

        case 7:
            int[] colorCodesForPhase7 = { 0, 1, 2, 3, 4, 5, 6 };
            {
                int a = colorCodesForPhase7.Length;
                while (a > 0)
                {
                    int i   = a - 1;
                    int j   = Random.Range(0, a);
                    int tmp = colorCodesForPhase7[i];
                    colorCodesForPhase7[i] = colorCodesForPhase7[j];
                    colorCodesForPhase7[j] = tmp;
                    a--;
                }
            }
            for (int i = 0; i < 5; i++)
            {
                for (int j = 0; j < 7; j++)
                {
                    float[] positionXs = { 0.0f, 60.0f, 30.0f, -30.0f, -60.0f, -30.0f, 30.0f };
                    float[] positionYs = { 0.0f, 0.0f, 52.0f, 52.0f, 0.0f, -52.0f, -52.0f };
                    float   positionX  = positionXs[j] + i * 200.0f - 400.0f;
                    float   positionY  = positionYs[j] + 100.0f;
                    if (j == 0)
                    {
                        prefabCreator.CreateHardRoundBlock(positionX, positionY);
                    }
                    else
                    {
                        prefabCreator.CreateRoundBlock(positionX, positionY, colorCodesForPhase7[i]);
                    }
                }
            }
            break;

        case 8:
            int colorCodeForPhase8a = Random.Range(0, 7);
            int colorCodeForPhase8b = Random.Range(0, 7);
            for (int i = 0; i < 3; i++)
            {
                for (int x = 0; x < 5; x++)
                {
                    for (int y = 0; y < 2; y++)
                    {
                        int[,] pattern = { { 1, 2, 3, 4, 5 }, { 0, 7, 8, 7, 6 } };
                        float positionX = x * 50.0f + i * 300.0f - 400.0f;
                        float positionY = y * 20.0f + 162.0f;
                        switch (pattern[y, x])
                        {
                        case 0:
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                            prefabCreator.CreateCountBlock(positionX, positionY, pattern[y, x], 4);
                            break;

                        case 7:
                            prefabCreator.CreateSilverBlock(positionX, positionY);
                            break;

                        case 8:
                            prefabCreator.CreateGoldBlock(positionX, positionY);
                            break;
                        }
                    }
                }
            }
            for (int x = 0; x < 20; x++)
            {
                float positionX = x * 50.0f - 475.0f;
                float positionY = 82.0f;
                int   colorCode = (colorCodeForPhase8a + x) % 7;
                prefabCreator.CreateNormalBlock(positionX, positionY, colorCode);
            }
            for (int x = 0; x < 50; x++)
            {
                float positionX = x * 20.0f - 490.0f;
                float positionY = 122.0f;
                int   colorCode = (colorCodeForPhase8b + x) % 7;
                prefabCreator.CreateSmallBlock(positionX, positionY, colorCode);
            }
            break;

        case 9:
            for (int x = 0; x < 19; x++)
            {
                for (int y = 0; y < 4; y++)
                {
                    int[,] pattern =
                    {
                        { 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1 },
                        { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
                        { 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1 },
                        { 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1 }
                    };
                    float positionX = x * 50.0f - 450.0f;
                    float positionY = y * 20.0f + 90.0f;
                    if (pattern[y, x] == 1)
                    {
                        prefabCreator.CreateTransparentBlock(positionX, positionY);
                    }
                }
            }
            break;

        case 10:
            for (int i = 0; i < 3; i++)
            {
                for (int x = 0; x < 5; x++)
                {
                    for (int y = 0; y < 5; y++)
                    {
                        int[,] pattern = { { 0, 0, 0, 0, 0 }, { 0, 1, 1, 1, 0 }, { 0, 1, 2, 1, 0 }, { 0, 1, 1, 1, 0 }, { 0, 0, 0, 0, 0 } };
                        float positionX = x * 50.0f + i * 300.0f - 400.0f;
                        float positionY = y * 20.0f + 75.0f;
                        switch (pattern[x, y])
                        {
                        case 0:
                            prefabCreator.CreateHardBlock(positionX, positionY);
                            break;

                        case 1:
                            prefabCreator.CreateTransparentBlock(positionX, positionY);
                            break;

                        case 2:
                            prefabCreator.CreateItemBlock(positionX, positionY, 8);
                            break;
                        }
                    }
                }
            }
            break;

        case 11:
            for (int x = 0; x < 9; x++)
            {
                int[] pattern   = { 0, 1, 0, 1, 0, 1, 0, 1, 0 };
                float positionX = x * 100.0f - 400.0f;
                float positionY = 120.0f;
                switch (pattern[x])
                {
                case 0:
                    prefabCreator.CreateAccelerateBlock(positionX, positionY);
                    break;

                case 1:
                    prefabCreator.CreateItemBlock(positionX, positionY, 21);
                    break;
                }
            }
            break;

        case 12:
            for (int x = 0; x < 7; x++)
            {
                float positionX = x * 140.0f - 420.0f;
                float positionY = 140.0f;
                int   colorCode = x;
                prefabCreator.CreateCountRoundBlock(positionX, positionY, colorCode, 10);
            }
            for (int x = 0; x < 7; x++)
            {
                float positionX = x * 110.0f - 330.0f;
                float positionY = 80.0f;
                int   colorCode = x;
                prefabCreator.CreateCountRoundBlock(positionX, positionY, colorCode, 6);
            }
            for (int x = 0; x < 7; x++)
            {
                float positionX = x * 80.0f - 240.0f;
                float positionY = 20.0f;
                int   colorCode = x;
                prefabCreator.CreateCountRoundBlock(positionX, positionY, colorCode, 3);
            }
            break;

        case 13:
            for (int x = 0; x < 3; x++)
            {
                float positionX = x * 300.0f - 300.0f;
                float positionY = 182.0f;
                prefabCreator.CreateItemBlock(positionX, positionY, 12);
            }
            break;

        case 14:
            for (int x = 0; x < 20; x++)
            {
                for (int y = 0; y < 4; y++)
                {
                    float positionX = x * 50.0f - 475.0f;
                    float positionY = y * 20.0f + 122.0f;
                    if (y % 2 == 0)
                    {
                        prefabCreator.CreateSilverBlock(positionX, positionY);
                    }
                    else
                    {
                        prefabCreator.CreateGoldBlock(positionX, positionY);
                    }
                }
            }
            break;
        }
    }
예제 #3
0
    void GenerateBlocks()
    {
        for (int i = 0; i < preparedBlocks.Length; i++)
        {
            float positionX = i * 50.0f - 475.0f;
            float positionY = 202.0f;
            switch (preparedBlocks[i])
            {
            case 1:
                prefabCreator.CreateNormalBlock(positionX, positionY, 0);
                break;

            case 2:
                prefabCreator.CreateNormalBlock(positionX, positionY, 1);
                break;

            case 3:
                prefabCreator.CreateNormalBlock(positionX, positionY, 2);
                break;

            case 4:
                prefabCreator.CreateNormalBlock(positionX, positionY, 3);
                break;

            case 5:
                prefabCreator.CreateNormalBlock(positionX, positionY, 4);
                break;

            case 6:
                prefabCreator.CreateNormalBlock(positionX, positionY, 5);
                break;

            case 7:
                prefabCreator.CreateNormalBlock(positionX, positionY, 6);
                break;

            case 8:
                prefabCreator.CreateItemBlock(positionX, positionY, 8);
                break;

            case 9:
                prefabCreator.CreateItemBlock(positionX, positionY, 9);
                break;

            case 10:
                prefabCreator.CreateItemBlock(positionX, positionY, 11);
                break;

            case 11:
                prefabCreator.CreateItemBlock(positionX, positionY, 13);
                break;

            case 12:
                prefabCreator.CreateItemBlock(positionX, positionY, 14);
                break;

            case 13:
                prefabCreator.CreateItemBlock(positionX, positionY, 19);
                break;

            case 14:
                prefabCreator.CreateItemBlock(positionX, positionY, 20);
                break;

            case 15:
                prefabCreator.CreateSilverBlock(positionX, positionY);
                break;

            case 16:
                prefabCreator.CreateGoldBlock(positionX, positionY);
                break;

            case 17:
                prefabCreator.CreateItemBlock(positionX, positionY, 7);
                break;

            case 18:
                prefabCreator.CreateItemBlock(positionX, positionY, 21);
                break;

            case 19:
                prefabCreator.CreateItemBlock(positionX, positionY, 22);
                break;

            case 20:
                prefabCreator.CreateItemBlock(positionX, positionY, 12);
                break;
            }
        }
    }