Exemple #1
0
    void Start()
    {
        stage = UIstage.startPanel;

        timer = 5.0f;

        bShowHighscore = false;
        bGame          = false;
    }
Exemple #2
0
 public void OpenShop()
 {
     if (stage == UIstage.startPanel)
     {
         stage = UIstage.shopPanel;
     }
     else if (stage == UIstage.shopPanel)
     {
         stage = UIstage.startPanel;
     }
 }
Exemple #3
0
    void Update()
    {
        ActivatePanel((int)stage);

        switch (stage)
        {
        case UIstage.startPanel:
        {
            if (bShowHighscore)
            {
                mainPanel.SetActive(false);
            }
            else
            {
                mainPanel.SetActive(true);
            }


            bestDistance.text = "" + PlayerPrefs.GetInt("BestDistance");
            bestCcoins.text   = "" + PlayerPrefs.GetInt("BestCoins");
            bestGems.text     = "" + PlayerPrefs.GetInt("BestGems");
            bestScore.text    = "" + PlayerPrefs.GetInt("BestScore");


            if (bGame)
            {
                stage = UIstage.gamePanel;
                target.StartRun();
            }
        }
        break;

        case UIstage.shopPanel:
        {
        }
        break;

        case UIstage.gamePanel:
        {
            if (target.dead)
            {
                if (target.extraLife == 1)
                {
                    stage = UIstage.extraLifePanel;
                }
                else
                {
                    stage = UIstage.statisticsPanel;
                }
            }
            else
            {
                distance.text = "" + target.GetDistance();
                coins.text    = "" + target.GetCoins();
                gems.text     = "" + target.GetGems();
            }
        } break;

        case UIstage.extraLifePanel:
        {
            timer       -= Time.deltaTime;
            counter.text = "" + (int)timer;

            counterImage.fillAmount = timer / 5;

            if (manager.extraAd)
            {
                timer = 5;

                stage = UIstage.gamePanel;
            }

            if (timer <= 0)
            {
                stage = UIstage.statisticsPanel;
            }
        }
        break;

        case UIstage.statisticsPanel:
        {
            if (manager.dcAd)
            {
                doubleAd.interactable = false;
            }

            distanceAmount.text = "" + target.GetDistance();
            coinsAmount.text    = "" + target.GetCoins();
            gemsAmount.text     = "" + target.GetGems();

            int score = 0;
            score += (target.GetDistance() * 10);
            score += (target.GetCoins() * 2);
            score += (target.GetGems() * 5);

            finalScore.text = "" + score;
        }
        break;
        }
    }