bubble_shooter_2d/Assets/Scripts/ScoreManager.cs
2025-06-01 09:14:39 +05:30

54 lines
787 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ScoreManager
{
private int score = 0;
private int throws = 0;
public static ScoreManager instance;
public static ScoreManager GetInstance()
{
if (instance == null)
instance = new ScoreManager();
return instance;
}
public void UpdateScoreUI()
{
// Text _score = GameObject.FindWithTag("Score").GetComponent<Text>();
// _score.text = $"Score: {score}";
}
public void AddScore(int score)
{
this.score += score;
UpdateScoreUI();
}
public int GetScore()
{
return score;
}
public void AddThrows()
{
throws++;
}
public int GetThrows()
{
return throws;
}
public void Reset()
{
score = 0;
throws = 0;
UpdateScoreUI();
}
}