Example #1
0
    // Move player, update countdown timer
    private void FixedUpdate()
    {
        // Reduce countdown clock
        countdown -= Time.deltaTime;

        // If still cycling, increment cycling timer
        if (countdown > 0)
        {
            cyclingTimer += Time.deltaTime;
        }
        // Otherwise, reset cycling timer
        else
        {
            cyclingTimer = 0.0f;
        }


        // Move player
        MovePlayer();

        // If player has sunk, game over
        if (transform.position.y < -0.13)
        {
            // Tell StatMgr to stop player life timer
            statMgr.StopLifeTimer();
            // Stop time, show end screen
            Time.timeScale = 0;
            gameOver       = true;
            gameOverScreen.SetActive(true);
        }
    }