24 lines
370 B
C#
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);
|
|
}
|
|
|
|
}
|