Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        if (lost)
        {
            StartCoroutine(endRace.loadingNextScene("MainArea"));
            return;
        }
        if (endRace.won)
        {
            won = true; return;
        }

        if (!countDownHasBegun && !runOnce)
        {
            Invoke(nameof(StartCountdown), waitTime);
            runOnce = true;
            return;
        }
        else if (countDownHasBegun)
        {
            if (countDownTime > 0)
            {
                countDownTime         -= Time.deltaTime;
                countDownTimeRemaining = Mathf.FloorToInt(countDownTime % 60);
            }
            else
            {
                raceHasBegun           = true;
                countDownTimeRemaining = 0;
                boar.BeginRace();
            }
        }
    }