Heya, new to Unity. Was following a tutorial on scoring system that increase the score when a collectible is collected.
Was wondering how do you reduce the score? (Example the UI is showing how many crystal is remaining and with each crystal collected, the amount is reduce)
Been trying but i cant seem to get it.
public class GemPoint : MonoBehaviour
{
public GameObject scoreBox;
public AudioSource collectSound;
void OnTriggerEnter()
{
GlobalScore.currentScore -= 1;
collectSound.Play();
Destroy(gameObject);
}
public class GlobalScore : MonoBehaviour
{
public GameObject scoreBox;
public static int currentScore;
public int InternalScore;
// Update is called once per frame
void Update()
{
InternalScore = currentScore;
scoreBox.GetComponent<Text>().text = "" + InternalScore;
}