Ejemplo n.º 1
0
    void CreatePlatformSequence()
    {
        gc.amountOfPlatforms += 1;
        gc.updateFloorCount();

        if (gc.amountOfPlatforms >= gc.highscore - 3 && !gc.highscoreShown)
        {
            gc.highscoreShown = true;
            GameObject highscoreGJ = Instantiate(
                gc.highscorePrefabInstance,
                new Vector3(0, gameObject.transform.position.y - 9f, 0),
                gameObject.transform.rotation
                );
            highscoreGJ.GetComponent <MeshRenderer>().sortingLayerName = "Foreground";
            highscoreGJ.GetComponent <MeshRenderer>().sortingOrder     = 25;
        }

        if (gc.gameType == -1)
        {
            WaterController.UpdateWaterSpeed();
        }

        if (gc.sandProbability + gc.diamondProbability != 1000)
        {
            if (gc.emptyProbability != 0)
            {
                gc.goldProbability  = gc.goldProbability - gc.probabilityMultiplier;
                gc.emptyProbability = gc.emptyProbability - gc.probabilityMultiplier;
            }
            else
            {
                gc.goldProbability = gc.goldProbability - (gc.probabilityMultiplier * 2);
            }

            gc.sandProbability    += gc.probabilityMultiplier;
            gc.diamondProbability += gc.probabilityMultiplier;
        }
        GameController.updateProbability();

        if (gc.gameType != -1 && gc.amountOfPlatforms == AMOUNT_OF_FLOORS)
        {
            GameObject chosen = gc.prefabEndInstance;
            Instantiate(
                chosen,
                new Vector3(0, gameObject.transform.position.y - 9f, 0),
                gameObject.transform.rotation
                );

            Destroy(gameObject.transform.parent.gameObject);
        }
        else if (gc.gameType == -1 || gc.gameType != -1 && gc.amountOfPlatforms < AMOUNT_OF_FLOORS)
        {
            int        platformIndex = GetPlatformIndex();
            GameObject chosen        = gc.gameObjectList[platformIndex] as GameObject;
            chosen.transform.position = new Vector3(0, gameObject.transform.position.y - 9f, 0);

            GameObject instChosen = Instantiate(
                chosen,
                new Vector3(0, gameObject.transform.position.y - 9f, 0),
                gameObject.transform.rotation
                );
            PickupRandomizer(instChosen);



            Destroy(gameObject.transform.parent.gameObject);
        }
        else
        {
            Destroy(gameObject.transform.parent.gameObject);
        }
    }