Пример #1
0
    // Update is called once per frame
    void Update()
    {
        NormalGoal.getPercentageReachedBananas(playerStats);
        if (!worldSpawner.goalReached)worldSpawner.setGoalReached(NormalGoal.isGoalReached(playerStats));
        if (worldSpawner.endTileReached)
        {
            if (NormalGoal.nextLevel())
            {
                if (wait15Sec())
                {
                    Application.LoadLevel(1);

                }
                else
                {
                    if (playerStats.roundBananaRatio() >= 0) displayNumber = 0;
                    if (playerStats.roundBananaRatio() > 10) displayNumber = 1;
                    if (playerStats.roundBananaRatio() > 20) displayNumber = 2;
                    if (playerStats.roundBananaRatio() > 30) displayNumber = 3;
                    if (playerStats.roundBananaRatio() > 40) displayNumber = 4;
                    Destroy(GameObject.Find("HUD"));
                    NormalGoal.rounds++;
                    fullScreen.guiTexture.texture = BetweenScreens[displayNumber];
                    // display wait round screen
                }

            }
            else
            {
                if (wait15Sec())
                {

                    Destroy(GameObject.Find("KinectPointMan"));
                    Destroy(GameObject.Find("KinectPrefab"));
                    Destroy(GameObject.Find("GameSettings"));
                    Application.LoadLevel(0);
                }
                else
                {
                    NormalGoal.rounds++;
                    if (!madeResults)
                    {
                        fullScreen.guiTexture.texture = goodScreen;
                        log = worldSpawner.log;
                        Result results = new Result(log);
                        int c = 0;
                        int[] ratios = new int[results.amountOfRounds*2];
                        foreach (RoundScore r in results.rounds)
                        {
                            ratios[(c * 2)] = r.getPickupRatio();
                            ratios[(c * 2) + 1] = r.getObstacleAvoidedRatio();
                            c++;
                        }
                        madeResults = true;
                        this.gameObject.GetComponent<mono_gmail>().mailStart(ratios,results.rounds[0].getStartTime(),results.totalAmountOfBananas(),results.totalAmountOfFeathers(),results.GetMostHitObstacle());

                    }
                    else
                    {
                        if (playerStats.roundBananaRatio() >= 0) displayNumber = 0;
                        if (playerStats.roundBananaRatio() > 10) displayNumber = 1;
                        if (playerStats.roundBananaRatio() > 20) displayNumber = 2;
                        if (playerStats.roundBananaRatio() > 30) displayNumber = 3;
                        if (playerStats.roundBananaRatio() > 40) displayNumber = 4;
                        Destroy(GameObject.Find("HUD"));
                        fullScreen.guiTexture.texture = EndScreens[displayNumber];
                        // goed gedaan screen
                    }
                }
            }

        }
    }