| | | 1 | | using System.Collections; |
| | | 2 | | using System.Collections.Generic; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using TMPro; |
| | | 5 | | |
| | | 6 | | public class Scoremanager : MonoBehaviour |
| | | 7 | | { |
| | | 8 | | public static Scoremanager instance; |
| | | 9 | | public TextMeshProUGUI ScoreText; |
| | | 10 | | public TextMeshProUGUI AmountUI; |
| | | 11 | | public int StarValue; |
| | | 12 | | public int winAmount; |
| | | 13 | | public WinLose winlosescript; |
| | | 14 | | public TextMeshProUGUI Timer; |
| | | 15 | | int score; |
| | | 16 | | // Start is called before the first frame update |
| | | 17 | | void Start() |
| | 14 | 18 | | { |
| | | 19 | | //winAmount.winAmount = "Stars to collect: " + AmountUI; |
| | | 20 | | |
| | 14 | 21 | | AmountUI.text = "Star Amount: " + winAmount.ToString(); |
| | 14 | 22 | | if (instance == null) |
| | 14 | 23 | | { |
| | 14 | 24 | | instance = this; |
| | 14 | 25 | | } |
| | | 26 | | |
| | 14 | 27 | | } |
| | | 28 | | public void changescore(int StarValue) |
| | 0 | 29 | | { |
| | 0 | 30 | | score += StarValue; |
| | 0 | 31 | | ScoreText.text = "Stars: " + score.ToString(); |
| | 0 | 32 | | if (score == winAmount) |
| | 0 | 33 | | { |
| | 0 | 34 | | winlosescript.Winlevel(); |
| | 0 | 35 | | } |
| | 0 | 36 | | } |
| | | 37 | | private void Update() |
| | 1029 | 38 | | { |
| | 1029 | 39 | | Timer.text = Time.time.ToString("0.0"); |
| | 1029 | 40 | | } |
| | | 41 | | |
| | | 42 | | |
| | | 43 | | } |