Ejemplo n.º 1
0
 // Start is called before the first frame update
 void Start()
 {
     if (SceneManager.GetActiveScene().buildIndex == 0)
     {
         int highscore = PlayerPrefsController.GetHighscore();
         GetComponent <TextMeshProUGUI>().text = highscore.ToString("00000");
     }
     else
     {
         int currentscore = PlayerPrefsController.GetCurrentScore();
         GetComponent <TextMeshProUGUI>().text = currentscore.ToString("00000");
     }
 }
Ejemplo n.º 2
0
 void Update()
 {
     if (!enterWasPressed)
     {
         if (Input.GetKeyDown(KeyCode.Return))
         {
             GetComponent <InputField>().readOnly = true;
             int    playerNumber = PlayerPrefsController.SetScore(PlayerPrefsController.GetCurrentScore());
             string playerName   = mainText.GetComponent <Text>().text;
             int    levelNumber  = PlayerPrefsController.GetCurrentLevel();
             string levelText    = "Level " + levelNumber.ToString();
             PlayerPrefsController.SetPlayer(playerNumber, playerName);
             PlayerPrefsController.SetLevel(playerNumber, levelText);
             FindObjectOfType <HighestScoreTable>().SetPlayerNameAndScore();
             enterWasPressed = true;
         }
     }
 }
Ejemplo n.º 3
0
 void Update()
 {
     scoreText.text = PlayerPrefsController.GetCurrentScore().ToString();
 }