Devlog 6: Scoring system

The scoring system is added to make the game have an objective other than get rid of enemies. Lots of players like to be able to see their progress through waves as they play rather than not gaining any feedback than disappearing enemies.

public static Score Instance;

[Header(“Score”)]
public int score = 0;

[Header(“UI”)]
public TextMeshProUGUI scoreText;

private void Awake()
{
if (Instance == null)
{
Instance = this;
}
else
{
Destroy(gameObject);
return;
}

}

private void Start()
{
UpdateScoreUI();
}

public void AddScore(int amount)
{
score += amount;
UpdateScoreUI();
}

private void UpdateScoreUI()
{
if (scoreText != null)
{
scoreText.text = “Score: ” + score.ToString();
}
}

Scroll to Top