simple UI added

This commit is contained in:
Mausham
2025-12-11 18:20:42 -08:00
parent 60e58082ac
commit 2118bb7c36
576 changed files with 126744 additions and 13 deletions

View File

@@ -0,0 +1,35 @@
using System;
using Unity.VisualScripting;
using UnityEngine;
public class ScoreService
{
public Action<int> onScoreUpdate;
public int score { get; private set; }
public int HighScore = PlayerPrefs.GetInt("HighScore", 0);
public void AddScore()
{
score += 5;
onScoreUpdate?.Invoke(score);
if(score>HighScore)
{
SetHighScore();
}
Debug.Log(score);
}
private void SetHighScore()
{
HighScore = score;
PlayerPrefs.SetInt("HighScore",HighScore);
PlayerPrefs.Save();
}
public int GetHighscore()
{
return PlayerPrefs.GetInt("HighScore",0);
}
}