예제 #1
0
    private void LoseLogic()
    {
        gameOverAnim.SetTrigger("gameover");
        totalWalls.text = "Total Walls : " + count;
        finalScore.text = "Final Score : " + playerScore;
        if (playerScoreSaved)
        {
            StaticScores.SaveScore(StaticScores.LastName, playerScore);
            playerScoreSaved = false;
        }

        //SceneManager.LoadScene("MenuScene");
    }
예제 #2
0
    void Update()
    {
        if (readyToPlay)
        {
            if (!startedGame)
            {
                SpawnNextWall();
                slider.gameObject.SetActive(true);
                startedGame = true;
            }

            if (playerLost)
            {
                /// TODO DO HIGHSCORE LOGIC HERE
                StaticScores.SaveScore(playerName.text, playerScore);
                HighScoreController.instance.UpdateHighScores();

                MyWallSpeed = 0;

                LoseLogic();

                return;
            }

            if (Time.frameCount % 10 == 0)
            {
                jointsCounter.text = jointsColliding.ToString();
            }

            ManagePanicBar();

            regenTimer += Time.deltaTime;

            if (regenTimer > regenTime)
            {
                if (currentValue > 0)
                {
                    currentValue -= 1;
                }
                regenTimer = 0;
            }
        }

        else
        {
            slider.gameObject.SetActive(false);
        }
    }