forked from GabrielGameDev/Endless-Runner-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUIManager.cs
More file actions
38 lines (32 loc) · 681 Bytes
/
Copy pathUIManager.cs
File metadata and controls
38 lines (32 loc) · 681 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UIManager : MonoBehaviour {
public Image[] lifeHearts;
public Text coinText;
public GameObject gameOverPanel;
public Text scoreText;
public void UpdateLives(int lives)
{
for (int i = 0; i < lifeHearts.Length; i++)
{
if(lives > i)
{
lifeHearts[i].color = Color.white;
}
else
{
lifeHearts[i].color = Color.black;
}
}
}
public void UpdateCoins(int coin)
{
coinText.text = coin.ToString();
}
public void UpdateScore(int score)
{
scoreText.text = "Score: " + score + "m";
}
}