Skip to content
Snippets Groups Projects
Commit 6204563c authored by Karlsen Adiyasa Bachtiar's avatar Karlsen Adiyasa Bachtiar
Browse files

save player score when game over

parent d191b5dc
Branches
No related merge requests found
......@@ -11,6 +11,7 @@ public class GameOverManager : MonoBehaviour
float restartTimer;
bool isGameOver = false;
bool isSaved = false;
void Awake()
......@@ -26,6 +27,11 @@ public class GameOverManager : MonoBehaviour
anim.SetBool("GameOver", true);
isGameOver = true;
if (!isSaved) {
DataManager.SaveData("dummy1", ScoreManager.finalScore, "ZEN");
isSaved = true;
}
restartTimer += Time.deltaTime;
if (restartTimer >= restartDelay)
......
......@@ -6,6 +6,7 @@ using System;
public class ScoreManager : MonoBehaviour
{
public static float score;
public static int finalScore;
int multiplier = 1;
......@@ -21,7 +22,7 @@ public class ScoreManager : MonoBehaviour
void Update ()
{
score += Time.deltaTime * multiplier;
finalScore = (int) score;
text.text = "Score: " + String.Format("{0:0}",score);
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment