public void RetryButtonClick()
 {
     // Saves the score and reloads the current scene to restart the level
     hs.AddScore(sController.Score);
     hs.SaveScoresToFile();
     SceneManager.LoadScene(1);
 }
 public void SubmitScore()
 {
     if (nameField.text != "")
     {
         HighscoreEntry entry = new HighscoreEntry(score, nameField.text);
         Highscores.AddScore(pos, entry, Highscores.LoadScores());
         gameObject.SetActive(false);
     }
 }
Beispiel #3
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (isDead)
        {
            return;
        }

        if (other.tag == "Worm")
        {
            StopAllCoroutines();

            Highscores.AddScore(Mathf.FloorToInt(TerrainController.Singleton.GetPlayerDistance() / 3f));
            isDead = true;
            Reset();
        }
    }
    public void SendHighscoreAndReturnToMainMenu()
    {
        if (input.text == null || input.text.Length < 3 || input.text.Length > 15)
        {
            input.text = "Length of nick 3-15 letters";
            return;
        }
        GameObject go;

        go = Instantiate(gameobj) as GameObject;
        go.transform.SetParent(transform);
        highscores = go.GetComponent <Highscores>();
        highscores.AddScore(input.text, PlayerBehaviour.totalScore);
        SceneManager.LoadScene(0);
        Destroy(go);
        Destroy(highscores);
    }
    private void AddHighScoreEntry(int score, string name)
    {
        // Create entry
        HighscoreEntry entry = new HighscoreEntry(score, name);

        // Load highscore table
        HighscoreList highscores = Highscores.LoadScores();

        int pos = Highscores.CheckScore(score, highscores.scoreList);

        if (pos != -1 && pos != 10)
        {
            Highscores.AddScore(pos, entry, highscores);
        }
        else
        {
            print("Score " + score + " too low. Discarding.");
        }

        Highscores.SaveScores(highscores);
    }