Exemplo n.º 1
0
    public void GenerateLevel3(float startShift, float deltaX, float gateHeight, int gatesCount, int probabilityGates)
    {
        Color objectsColor = new Color(0.6f, 0.6f, 0.7f, 1.0f);

        //SetColorOfObjects(new Color(0.2f, 0.2f, 0.2f, 1.0f));
        isNight        = true;
        isNightNoLight = false;
        objectsColor   = new Color(0.6f, 0.6f, 0.6f, 1.0f);
        SetColorOfObjects(objectsColor);

        FlyingBall flyingBall = FindObjectOfType <FlyingBall>();

        flyingBall.GetComponent <SpriteRenderer>().color = objectsColor;

        background.GetComponent <SpriteRenderer>().color = objectsColor;

        // Трава
        Renderer level1layer1r     = level1layer1.GetComponent <Renderer>();
        float    level1layer1width = level1layer1r.bounds.size.x;

        for (int i = 0; i < 4.0 * (gatesCount + 2) * deltaX / level1layer1width; i++)
        {
            float      cur_x            = -startShift + i * level1layer1width;
            float      cur_y            = level1layer1r.bounds.size.y;
            GameObject cur_level1layer1 = Instantiate <GameObject>(level1layer1);
            cur_level1layer1.GetComponent <SpriteRenderer>().color = objectsColor;
            Level1 cur_level1layer1_script = cur_level1layer1.GetComponent <Level1>();
            cur_level1layer1_script.SetPosition(cur_x, -10.0f + cur_y * 0.5f, 0.0f);
            cur_level1layer1_script.xShift = 0.04f * 2.0f;
        }
        // Небо
        Renderer level1layer2r     = level1layer2up.GetComponent <Renderer>();
        float    level1layer2width = level1layer2r.bounds.size.x;

        for (int i = 0; i < (gatesCount + 2) * deltaX / level1layer1width; i++)
        {
            float      cur_x            = -startShift + i * level1layer2width;
            float      cur_y            = level1layer2r.bounds.size.y;
            GameObject cur_level1layer2 = Instantiate <GameObject>(level1layer2up);
            cur_level1layer2.GetComponent <SpriteRenderer>().color = objectsColor;
            Level1 cur_level1layer2_script = cur_level1layer2.GetComponent <Level1>();
            cur_level1layer2_script.SetPosition(cur_x, 10.0f - cur_y * 0.5f, 0.0f);
            cur_level1layer2_script.xShift = 0.04f * 0.5f;
        }

        int centerPhaseGates = 0;

        for (int i = 0; i < gatesCount; i++)
        {
            float cur_x = startShift + i * deltaX;
            //GameObject cur_brik_border_up = Instantiate<GameObject>(brikBorder);
            //Level1 cur_brik_border_instance_up = cur_brik_border_up.GetComponent<Level1>();
            //cur_brik_border_instance_up.SetPosition(cur_x, 11.0f, 0.0f);
            //cur_brik_border_instance_up.xShift = 0.04f;

            if (Random.Range(0, 99) > probabilityGates)
            {
                continue;
            }

            float cur_h_add = Random.Range(-4.0f, 0.0f) - 3.0f * Mathf.Sin(i * 0.4f) - 1.0f;
            float cur_x_add = Random.Range(-deltaX * 0.2f, deltaX * 0.2f);
            //if(brik == null)
            //{
            //    Debug.Log("Brick"+i+" : cur_x = "+ cur_x + "; cur_y = "+ cur_y);
            //}

            // Маленькие деревья
            float      curS_h_add     = Random.Range(-6.0f, 0.0f) - 4.0f;
            float      curS_x_add     = Random.Range(-deltaX * 0.8f, deltaX * 0.8f);
            GameObject cur_pineS_down = null;
            switch (Random.Range(0, 3))
            {
            case 0:
                cur_pineS_down = Instantiate <GameObject>(level1pine1);
                break;

            case 1:
                cur_pineS_down = Instantiate <GameObject>(level1pine2);
                break;

            case 2:
                cur_pineS_down = Instantiate <GameObject>(level1pine3);
                break;
            }
            cur_pineS_down.GetComponent <SpriteRenderer>().color = objectsColor;
            Renderer cur_pineS_down_r        = cur_pineS_down.GetComponent <Renderer>();
            float    pineS_cur_y             = cur_pineS_down_r.bounds.size.y;
            Level1   cur_pineS_instance_down = cur_pineS_down.GetComponent <Level1>();
            cur_pineS_instance_down.SetPosition(cur_x + curS_x_add, -10.0f + pineS_cur_y * 0.5f + curS_h_add, 0.0f);
            cur_pineS_instance_down.xShift = 0.04f;

            if (i % 2 == 0 && (Random.Range(0, 100) < 20))
            {
                centerPhaseGates = 10;
            }
            if (centerPhaseGates > 0)
            {
                centerPhaseGates--;
            }
            if (centerPhaseGates == 0)
            {
                // Большие деревья
                if (Random.Range(0, 100) < probabilityGates)
                {
                    GameObject cur_brik_down = null;
                    switch (Random.Range(0, 3))
                    {
                    case 0:
                        cur_brik_down = Instantiate <GameObject>(level1pine1);
                        break;

                    case 1:
                        cur_brik_down = Instantiate <GameObject>(level1pine2);
                        break;

                    case 2:
                        cur_brik_down = Instantiate <GameObject>(level1pine3);
                        break;
                    }
                    cur_brik_down.GetComponent <SpriteRenderer>().color = objectsColor;
                    Renderer cur_brik_down_r        = cur_brik_down.GetComponent <Renderer>();
                    float    cur_y                  = cur_brik_down_r.bounds.size.y;
                    Level1   cur_brik_instance_down = cur_brik_down.GetComponent <Level1>();
                    cur_brik_instance_down.SetPosition(cur_x + cur_x_add, -10.0f + cur_y * 0.5f + cur_h_add, 0.0f);
                    cur_brik_instance_down.xShift = 0.04f;
                    // Облака
                    if (Random.Range(0, 100) < 100)
                    {
                        int j = 0;
                        while (true)
                        {
                            float      cur_x_add2     = Random.Range(-2.0f, 2.0f);
                            GameObject cur_cloud_down = null;
                            switch (Random.Range(0, 3))
                            {
                            case 0:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds1);
                                break;

                            case 1:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds2);
                                break;

                            case 2:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds3);
                                break;
                            }
                            SpriteRenderer[] allChildren = cur_cloud_down.GetComponentsInChildren <SpriteRenderer>();
                            foreach (SpriteRenderer child in allChildren)
                            {
                                SpriteRenderer sr = child.GetComponent <SpriteRenderer>();
                                sr.color = objectsColor;
                                // do what you want with the transform
                            }
                            Renderer cur_cloud_down_r      = cur_cloud_down.GetComponentInChildren <Renderer>();
                            float    cloud_h               = cur_cloud_down_r.bounds.size.y;
                            Level1   cur_cloud_down_level1 = cur_cloud_down.GetComponent <Level1>();
                            cur_cloud_down_level1.SetPosition(cur_x + cur_x_add + cur_x_add2, -10.0f + cur_y * 1.0f + cloud_h * (j * 1.1f + 0.5f) + gateHeight * 1.2f + cur_h_add, 0.0f);
                            cur_cloud_down_level1.xShift = 0.04f;
                            if (-10.0f + cur_y * 1.0f + cloud_h * (j * 1.1f + 0.5f) + gateHeight * 1.2f + cur_h_add > 10.0f - cloud_h)
                            {
                                break;
                            }
                            j++;
                        }
                    }
                }
                else
                {
                    //GameObject cur_brik_center = Instantiate<GameObject>(brik2);
                    //Level1 cur_brik2_instance = cur_brik_center.GetComponent<Level1>();
                    //cur_brik2_instance.SetPosition(cur_x, cur_y - cur_h_add, 0.0f);
                    //cur_brik2_instance.xShift = 0.04f;
                }
            }
            if (centerPhaseGates >= 7)
            {
                // Высокие деревья
                float      cur_h_add2    = Random.Range(-4.0f, 0.0f);
                GameObject cur_brik_down = null;
                switch (Random.Range(0, 3))
                {
                case 0:
                    cur_brik_down = Instantiate <GameObject>(level1pine1);
                    break;

                case 1:
                    cur_brik_down = Instantiate <GameObject>(level1pine2);
                    break;

                case 2:
                    cur_brik_down = Instantiate <GameObject>(level1pine3);
                    break;
                }
                cur_brik_down.GetComponent <SpriteRenderer>().color = objectsColor;
                Renderer cur_brik_down_r        = cur_brik_down.GetComponent <Renderer>();
                float    cur_y                  = cur_brik_down_r.bounds.size.y;
                Level1   cur_brik_instance_down = cur_brik_down.GetComponent <Level1>();
                cur_brik_instance_down.SetPosition(cur_x + cur_x_add, -10.0f + cur_y * 0.5f + cur_h_add2, 0.0f);
                cur_brik_instance_down.xShift = 0.04f;
            }

            if (centerPhaseGates == 6)
            {
                // выключаем горелку
                float             cur_x_add2             = Random.Range(-2.0f, 2.0f);
                GameObject        cur_event_loader       = Instantiate <GameObject>(level2eventLighter);
                EventLighterStart cur_event_loader_event = cur_event_loader.GetComponent <EventLighterStart>();
                cur_event_loader_event.SetPosition(cur_x + cur_x_add + cur_x_add2, 2.0f + cur_h_add * 0.5f, 0.0f);
                cur_event_loader_event.xShift = 0.04f;
            }
        }

        float      win_x            = startShift + (gatesCount - 1) * deltaX;
        GameObject cur_win          = Instantiate <GameObject>(winBorder);
        WinBorder  cur_win_instance = cur_win.GetComponent <WinBorder>();

        cur_win_instance.SetPosition(win_x, 0.0f, 0.0f);
        cur_win_instance.xShift = 0.04f;
    }
Exemplo n.º 2
0
    public void GenerateLevel2_presaved(float startShift,
                                        float deltaX,
                                        float gateHeight,
                                        int gatesCount,
                                        int probabilityGates,
                                        List <int> prob_gates_arr,
                                        List <float> cur_h_add_ar,
                                        List <float> cur_x_add_ar,
                                        List <float> curS_h_add_ar,
                                        List <float> curS_x_add_ar,
                                        List <int> cur_pineS_down_variant,
                                        List <int> centerPhaseGates_prob)
    {
        // Трава
        Renderer level1layer1r     = level1layer1.GetComponent <Renderer>();
        float    level1layer1width = level1layer1r.bounds.size.x;

        for (int i = 0; i < 4.0 * (gatesCount + 2) * deltaX / level1layer1width; i++)
        {
            float      cur_x                   = -startShift + i * level1layer1width;
            float      cur_y                   = level1layer1r.bounds.size.y;
            GameObject cur_level1layer1        = Instantiate <GameObject>(level1layer1);
            Level1     cur_level1layer1_script = cur_level1layer1.GetComponent <Level1>();
            cur_level1layer1_script.SetPosition(cur_x, -10.0f + cur_y * 0.5f, 0.0f);
            cur_level1layer1_script.xShift = worldSpeed * 2.0f;
        }
        // Небо
        Renderer level1layer2r     = level1layer2up.GetComponent <Renderer>();
        float    level1layer2width = level1layer2r.bounds.size.x;

        for (int i = 0; i < (gatesCount + 2) * deltaX / level1layer1width; i++)
        {
            float      cur_x                   = -startShift + i * level1layer2width;
            float      cur_y                   = level1layer2r.bounds.size.y;
            GameObject cur_level1layer2        = Instantiate <GameObject>(level1layer2up);
            Level1     cur_level1layer2_script = cur_level1layer2.GetComponent <Level1>();
            cur_level1layer2_script.SetPosition(cur_x, 10.0f - cur_y * 0.5f, 0.0f);
            cur_level1layer2_script.xShift = worldSpeed * 0.5f;
        }

        int centerPhaseGates = 0;

        for (int i = 0; i < gatesCount; i++)
        {
            float      cur_x = startShift + i * deltaX;
            GameObject cur_brik_border_up          = Instantiate <GameObject>(brikBorder);
            Level1     cur_brik_border_instance_up = cur_brik_border_up.GetComponent <Level1>();
            cur_brik_border_instance_up.SetPosition(cur_x, 11.0f, 0.0f);
            cur_brik_border_instance_up.xShift = worldSpeed;

            int prob = prob_gates_arr[i]; // from saved level!

            if (prob > probabilityGates)
            {
                continue;
            }

            //for save
            float cur_h_add = cur_h_add_ar[i];
            float cur_x_add = cur_x_add_ar[i];

            //if(brik == null)
            //{
            //    Debug.Log("Brick"+i+" : cur_x = "+ cur_x + "; cur_y = "+ cur_y);
            //}

            // Маленькие деревья
            //for save
            float curS_h_add = curS_h_add_ar[i];
            float curS_x_add = curS_x_add_ar[i];


            GameObject cur_pineS_down = null;
            //for save
            int variant = cur_pineS_down_variant[i];
            switch (variant)
            {
            case 0:
                cur_pineS_down = Instantiate <GameObject>(level1pine1);
                break;

            case 1:
                cur_pineS_down = Instantiate <GameObject>(level1pine2);
                break;

            case 2:
                cur_pineS_down = Instantiate <GameObject>(level1pine3);
                break;
            }
            Renderer cur_pineS_down_r        = cur_pineS_down.GetComponent <Renderer>();
            float    pineS_cur_y             = cur_pineS_down_r.bounds.size.y;
            Level1   cur_pineS_instance_down = cur_pineS_down.GetComponent <Level1>();
            cur_pineS_instance_down.SetPosition(cur_x + curS_x_add, -10.0f + pineS_cur_y * 0.5f + curS_h_add, 0.0f);
            cur_pineS_instance_down.xShift = worldSpeed;

            //for save
            prob = centerPhaseGates_prob[i];

            if (i % 2 == 0 && (prob < 20))
            {
                centerPhaseGates = 6;
            }
            if (centerPhaseGates > 0)
            {
                centerPhaseGates--;
            }
            if (centerPhaseGates == 0)
            {
                // Большие деревья
                if (Random.Range(0, 100) < probabilityGates)
                {
                    GameObject cur_brik_down = null;
                    switch (Random.Range(0, 3))
                    {
                    case 0:
                        cur_brik_down = Instantiate <GameObject>(level1pine1);
                        break;

                    case 1:
                        cur_brik_down = Instantiate <GameObject>(level1pine2);
                        break;

                    case 2:
                        cur_brik_down = Instantiate <GameObject>(level1pine3);
                        break;
                    }
                    Renderer cur_brik_down_r        = cur_brik_down.GetComponent <Renderer>();
                    float    cur_y                  = cur_brik_down_r.bounds.size.y;
                    Level1   cur_brik_instance_down = cur_brik_down.GetComponent <Level1>();
                    cur_brik_instance_down.SetPosition(cur_x + cur_x_add, -10.0f + cur_y * 0.5f + cur_h_add, 0.0f);
                    cur_brik_instance_down.xShift = worldSpeed;
                    // Облака
                    //if (Random.Range(0, 100) < 100)
                    if (i % 2 == 0)
                    {
                        int j = 0;
                        while (true)
                        {
                            float      cur_x_add2     = Random.Range(-1.0f, 1.0f);
                            GameObject cur_cloud_down = null;
                            switch (Random.Range(0, 3))
                            {
                            case 0:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds1);
                                break;

                            case 1:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds2);
                                break;

                            case 2:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds3);
                                break;
                            }
                            Renderer cur_cloud_down_r      = cur_cloud_down.GetComponentInChildren <Renderer>();
                            float    cloud_h               = cur_cloud_down_r.bounds.size.y;
                            Level1   cur_cloud_down_level1 = cur_cloud_down.GetComponent <Level1>();
                            cur_cloud_down_level1.SetPosition(cur_x + cur_x_add + cur_x_add2, -10.0f + cur_y * 1.0f + cloud_h * (j * 1.1f + 0.5f) + gateHeight * 1.2f + cur_h_add, 0.0f);
                            cur_cloud_down_level1.xShift = worldSpeed;
                            if (-10.0f + cur_y * 1.0f + cloud_h * (j * 1.1f + 0.5f) + gateHeight * 1.2f + cur_h_add > 10.0f - cloud_h)
                            {
                                break;
                            }
                            j++;
                        }
                    }
                }
                else
                {
                    //GameObject cur_brik_center = Instantiate<GameObject>(brik2);
                    //Level1 cur_brik2_instance = cur_brik_center.GetComponent<Level1>();
                    //cur_brik2_instance.SetPosition(cur_x, cur_y - cur_h_add, 0.0f);
                    //cur_brik2_instance.xShift = 0.04f;
                }
            }
            if (centerPhaseGates == 3)
            {
                // Тучка по центру
                float      cur_x_add2     = Random.Range(-2.0f, 2.0f);
                GameObject cur_cloud_down = null;
                switch (Random.Range(0, 3))
                {
                case 0:
                    cur_cloud_down = Instantiate <GameObject>(level1clouds1);
                    break;

                case 1:
                    cur_cloud_down = Instantiate <GameObject>(level1clouds2);
                    break;

                case 2:
                    cur_cloud_down = Instantiate <GameObject>(level1clouds3);
                    break;
                }
                Renderer cur_cloud_down_r      = cur_cloud_down.GetComponentInChildren <Renderer>();
                float    cloud_h               = cur_cloud_down_r.bounds.size.y;
                Level1   cur_cloud_down_level1 = cur_cloud_down.GetComponent <Level1>();
                cur_cloud_down_level1.SetPosition(cur_x + cur_x_add + cur_x_add2, -3.0f - cur_h_add * 1.5f, 0.0f);
                cur_cloud_down_level1.xShift = worldSpeed;
            }
        }

        float      win_x            = startShift + (gatesCount - 1) * deltaX;
        GameObject cur_win          = Instantiate <GameObject>(winBorder);
        WinBorder  cur_win_instance = cur_win.GetComponent <WinBorder>();

        cur_win_instance.SetPosition(win_x, 0.0f, 0.0f);
        cur_win_instance.xShift = worldSpeed;
    }
Exemplo n.º 3
0
    public void GenerateLevel2(float startShift, float deltaX, float gateHeight, int gatesCount, int probabilityGates)
    {
        isNight        = false;
        isNightNoLight = false;
        objectsColor   = new Color(1.0f, 1.0f, 1.0f, 1.0f);
        SetColorOfObjects(objectsColor);
        // Трава
        Renderer level1layer1r     = level1layer1.GetComponent <Renderer>();
        float    level1layer1width = level1layer1r.bounds.size.x;

        for (int i = 0; i < 4.0 * (gatesCount + 2) * deltaX / level1layer1width; i++)
        {
            float      cur_x                   = -startShift + i * level1layer1width;
            float      cur_y                   = level1layer1r.bounds.size.y;
            GameObject cur_level1layer1        = Instantiate <GameObject>(level1layer1);
            Level1     cur_level1layer1_script = cur_level1layer1.GetComponent <Level1>();
            cur_level1layer1_script.SetPosition(cur_x, -10.0f + cur_y * 0.5f, 0.0f);
            cur_level1layer1_script.xShift = 0.04f * 2.0f;
        }
        // Небо
        Renderer level1layer2r     = level1layer2up.GetComponent <Renderer>();
        float    level1layer2width = level1layer2r.bounds.size.x;

        for (int i = 0; i < (gatesCount + 2) * deltaX / level1layer1width; i++)
        {
            float      cur_x                   = -startShift + i * level1layer2width;
            float      cur_y                   = level1layer2r.bounds.size.y;
            GameObject cur_level1layer2        = Instantiate <GameObject>(level1layer2up);
            Level1     cur_level1layer2_script = cur_level1layer2.GetComponent <Level1>();
            cur_level1layer2_script.SetPosition(cur_x, 10.0f - cur_y * 0.5f, 0.0f);
            cur_level1layer2_script.xShift = 0.04f * 0.5f;
        }

        int centerPhaseGates = 0;

        for (int i = 0; i < gatesCount; i++)
        {
            float      cur_x = startShift + i * deltaX;
            GameObject cur_brik_border_up          = Instantiate <GameObject>(brikBorder);
            Level1     cur_brik_border_instance_up = cur_brik_border_up.GetComponent <Level1>();
            cur_brik_border_instance_up.SetPosition(cur_x, 11.0f, 0.0f);
            cur_brik_border_instance_up.xShift = 0.04f;

            if (Random.Range(0, 99) > probabilityGates)
            {
                continue;
            }

            float cur_h_add = Random.Range(-4.0f, 0.0f) - 3.0f * Mathf.Sin(i * 0.4f) - 1.0f;
            float cur_x_add = Random.Range(-deltaX * 0.2f, deltaX * 0.2f);
            //if(brik == null)
            //{
            //    Debug.Log("Brick"+i+" : cur_x = "+ cur_x + "; cur_y = "+ cur_y);
            //}

            // Маленькие деревья
            float      curS_h_add     = Random.Range(-6.0f, 0.0f) - 4.0f;
            float      curS_x_add     = Random.Range(-deltaX * 0.8f, deltaX * 0.8f);
            GameObject cur_pineS_down = null;
            switch (Random.Range(0, 3))
            {
            case 0:
                cur_pineS_down = Instantiate <GameObject>(level1pine1);
                break;

            case 1:
                cur_pineS_down = Instantiate <GameObject>(level1pine2);
                break;

            case 2:
                cur_pineS_down = Instantiate <GameObject>(level1pine3);
                break;
            }
            Renderer cur_pineS_down_r        = cur_pineS_down.GetComponent <Renderer>();
            float    pineS_cur_y             = cur_pineS_down_r.bounds.size.y;
            Level1   cur_pineS_instance_down = cur_pineS_down.GetComponent <Level1>();
            cur_pineS_instance_down.SetPosition(cur_x + curS_x_add, -10.0f + pineS_cur_y * 0.5f + curS_h_add, 0.0f);
            cur_pineS_instance_down.xShift = 0.04f;

            if (i % 2 == 0 && (Random.Range(0, 100) < 20))
            {
                centerPhaseGates = 6;
            }
            if (centerPhaseGates > 0)
            {
                centerPhaseGates--;
            }
            if (centerPhaseGates == 0)
            {
                // Большие деревья
                if (Random.Range(0, 100) < probabilityGates)
                {
                    GameObject cur_brik_down = null;
                    switch (Random.Range(0, 3))
                    {
                    case 0:
                        cur_brik_down = Instantiate <GameObject>(level1pine1);
                        break;

                    case 1:
                        cur_brik_down = Instantiate <GameObject>(level1pine2);
                        break;

                    case 2:
                        cur_brik_down = Instantiate <GameObject>(level1pine3);
                        break;
                    }
                    Renderer cur_brik_down_r        = cur_brik_down.GetComponent <Renderer>();
                    float    cur_y                  = cur_brik_down_r.bounds.size.y;
                    Level1   cur_brik_instance_down = cur_brik_down.GetComponent <Level1>();
                    cur_brik_instance_down.SetPosition(cur_x + cur_x_add, -10.0f + cur_y * 0.5f + cur_h_add, 0.0f);
                    cur_brik_instance_down.xShift = 0.04f;
                    // Облака
                    if (Random.Range(0, 100) < 100)
                    {
                        int j = 0;
                        while (true)
                        {
                            float      cur_x_add2     = Random.Range(-2.0f, 2.0f);
                            GameObject cur_cloud_down = null;
                            switch (Random.Range(0, 3))
                            {
                            case 0:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds1);
                                break;

                            case 1:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds2);
                                break;

                            case 2:
                                cur_cloud_down = Instantiate <GameObject>(level1clouds3);
                                break;
                            }
                            Renderer cur_cloud_down_r      = cur_cloud_down.GetComponentInChildren <Renderer>();
                            float    cloud_h               = cur_cloud_down_r.bounds.size.y;
                            Level1   cur_cloud_down_level1 = cur_cloud_down.GetComponent <Level1>();
                            cur_cloud_down_level1.SetPosition(cur_x + cur_x_add + cur_x_add2, -10.0f + cur_y * 1.0f + cloud_h * (j * 1.1f + 0.5f) + gateHeight * 1.2f + cur_h_add, 0.0f);
                            cur_cloud_down_level1.xShift = 0.04f;
                            if (-10.0f + cur_y * 1.0f + cloud_h * (j * 1.1f + 0.5f) + gateHeight * 1.2f + cur_h_add > 10.0f - cloud_h)
                            {
                                break;
                            }
                            j++;
                        }
                    }
                }
                else
                {
                    //GameObject cur_brik_center = Instantiate<GameObject>(brik2);
                    //Level1 cur_brik2_instance = cur_brik_center.GetComponent<Level1>();
                    //cur_brik2_instance.SetPosition(cur_x, cur_y - cur_h_add, 0.0f);
                    //cur_brik2_instance.xShift = 0.04f;
                }
            }
            if (centerPhaseGates == 3)
            {
                // Тучка по центру
                float      cur_x_add2     = Random.Range(-2.0f, 2.0f);
                GameObject cur_cloud_down = null;
                switch (Random.Range(0, 3))
                {
                case 0:
                    cur_cloud_down = Instantiate <GameObject>(level1clouds1);
                    break;

                case 1:
                    cur_cloud_down = Instantiate <GameObject>(level1clouds2);
                    break;

                case 2:
                    cur_cloud_down = Instantiate <GameObject>(level1clouds3);
                    break;
                }
                Renderer cur_cloud_down_r      = cur_cloud_down.GetComponentInChildren <Renderer>();
                float    cloud_h               = cur_cloud_down_r.bounds.size.y;
                Level1   cur_cloud_down_level1 = cur_cloud_down.GetComponent <Level1>();
                cur_cloud_down_level1.SetPosition(cur_x + cur_x_add + cur_x_add2, 2.0f + cur_h_add * 0.5f, 0.0f);
                cur_cloud_down_level1.xShift = 0.04f;
            }
        }

        float      win_x            = startShift + (gatesCount - 1) * deltaX;
        GameObject cur_win          = Instantiate <GameObject>(winBorder);
        WinBorder  cur_win_instance = cur_win.GetComponent <WinBorder>();

        cur_win_instance.SetPosition(win_x, 0.0f, 0.0f);
        cur_win_instance.xShift = 0.04f;
    }