Advertisement
Guest User

Untitled

a guest
Apr 1st, 2020
276
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. public class PermanentUI : MonoBehaviour
  2. {
  3. public int cherries = 0;
  4. public int cherriesLastLevel;
  5. public int lives = 3;
  6. public int level = 0;
  7. public TextMeshProUGUI cherryText;
  8. public TextMeshProUGUI livesText;
  9.  
  10. public static PermanentUI permanent;
  11.  
  12. public void Start()
  13. {
  14. DontDestroyOnLoad(gameObject);
  15.  
  16. // Singleton Pattern
  17. if (!permanent)
  18. {
  19. permanent = this;
  20. }
  21. else
  22. {
  23. Destroy(gameObject);
  24. }
  25. }
  26.  
  27. public void SavePlayer()
  28. {
  29. SaveSystem.SavePlayer(this);
  30. }
  31.  
  32. public void Reset()
  33. {
  34. cherries = cherriesLastLevel;
  35. cherryText.text = cherries.ToString();
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement