Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            Application.Quit();
        }

        _score += Time.deltaTime * 10;

        if (_score > 500f)
        {
            ObstacleController.Unlock();
        }

        if ((int)_score != 0 && (int)_score % 125f == 0)
        {
            Dino.Speed = Dino.DefaultSpeed + _score / 125f;
        }

        float ratio = 1 - (_score > 1000f ? 1000f : _score) / 2000f;

        ObstacleController.SetInterval(ratio);

        if ((int)_score != 0 && (int)_score % 100f == 0)
        {
            ScoreView.Blink();
        }
        ScoreView.SetScore(_score);
    }