Question by
silviuunc · Jul 14, 2019 at 07:19 AM ·
c#programming
How to reset score when game restart,How to reset score on game restart?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;
public class GameMaster : MonoBehaviour
{
public GameObject restartPanel;
public Text score;
private bool asLost;
private void Update()
{
if(asLost == false) {
score.text = Time.time.ToString("F0");
}
}
public void GameOver()
{
asLost = true;
Invoke("Delay",0.75f);
}
void Delay()
{
restartPanel.SetActive(true);
}
public void GoToGameScene()
{
SceneManager.LoadScene("GAME");
}
public void Restart()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}
public void GoToMainMenu()
{
SceneManager.LoadScene("Main Menu");
}
}
Comment
Your answer
Follow this Question
Related Questions
Help with pause menu? 0 Answers
Setting up a New Data Type - Am I Doing Something Wrong? 1 Answer
Game Clock (Like in "The Escapist") 1 Answer