Files
HelixJump/Assets/Scripts/ScoreService/ScoreService.cs
2025-12-14 18:16:49 +05:45

24 lines
370 B
C#

using UnityEngine;
public class ScoreService
{
public int score=0;
public int highScore=0;
public void AddScore()
{
score += 5;
if (score>highScore)
{
SetNewHighScore();
}
}
private void SetNewHighScore()
{
highScore = score;
PlayerPrefs.SetInt("HighScore", highScore);
}
}