38 lines
912 B
C#
38 lines
912 B
C#
using UnityEngine;
|
|
using TMPro;
|
|
|
|
public class ScoreManager : MonoBehaviour
|
|
{
|
|
public static ScoreManager Instance;
|
|
|
|
[SerializeField] private TextMeshProUGUI scoreText;
|
|
|
|
[System.NonSerialized] public bool isAddingPoints = false;
|
|
private void Awake()
|
|
{
|
|
Instance = this;
|
|
}
|
|
|
|
void Start()
|
|
{
|
|
scoreText.text = 0.ToString();
|
|
}
|
|
|
|
public void AddPoints(int scoreToAdd)
|
|
{
|
|
isAddingPoints = true;
|
|
Pooler.Instance.SpawnFloatingText($"+{scoreToAdd}", Color.yellow);
|
|
}
|
|
|
|
public void RemovePoints(int scoreToRemove)
|
|
{
|
|
isAddingPoints = false;
|
|
Pooler.Instance.SpawnFloatingText($"{scoreToRemove}", Color.red);
|
|
}
|
|
public void AddHeadShotMessage()
|
|
{
|
|
isAddingPoints = true; //this is here so Headshot text doesnt turn red randomly.
|
|
Pooler.Instance.SpawnFloatingText("HEADSHOT!", Color.yellow);
|
|
}
|
|
}
|