mirror of
https://github.com/boudji-ludwig-pett/cnam-geometry-dash.git
synced 2025-06-10 22:20:40 +02:00
feat: stats display (#45)
This commit is contained in:
28
Assets/Scripts/LevelsSelect/LevelTotalJumps.cs
Normal file
28
Assets/Scripts/LevelsSelect/LevelTotalJumps.cs
Normal file
@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class LevelTotalJumps : MonoBehaviour
|
||||
{
|
||||
public Text levelTotalJumpsText;
|
||||
|
||||
public LevelsLoader levelsLoader;
|
||||
|
||||
private string GetText()
|
||||
{
|
||||
int number = levelsLoader.levelCurrent.TotalJumps;
|
||||
FormattableString message = $"{number:N0}";
|
||||
return "Total Jumps: " + FormattableString.Invariant(message);
|
||||
}
|
||||
|
||||
public void Start()
|
||||
{
|
||||
levelsLoader = GameObject.FindGameObjectWithTag("LevelsLoader").GetComponent<LevelsLoader>();
|
||||
levelTotalJumpsText.text = GetText();
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
levelTotalJumpsText.text = GetText();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user