private void CountTime() { timer += Time.deltaTime; points = Mathf.RoundToInt(timer + (gameSpeed)) + 10 * coins; gameScoreText.text = Mathf.RoundToInt(timer + (gameSpeed)).ToString() + "m"; if (timer / 10 > timeElapsed) { timeElapsed++; ts.timeBetweenTraps = Mathf.Clamp(ts.timeBetweenTraps - 0.25f, 0.5f, 10f); gameSpeed += 0.03f; ts.StopSpawning(); ts.StartSpawning(); } }
private void StopGame() { gameRunnning = false; gameSpeed = 0f; ts = FindObjectOfType <TrapSpawner>(); ts.StopSpawning(); player.StopPlayer(); monster.StopMonster(); if (points > highscore) { PlayerPrefs.SetInt("highscore", points); highscoreText.text = "New highscore!"; } else { highscoreText.text = ""; } endScoreText.text = "Score\n" + points.ToString(); PlayerPrefs.SetInt("lastScore", points); gameOverPanel.SetActive(true); }