using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class uiManager : MonoBehaviour {
public Text ScoreText;
bool gameOver;
int score;
// Use this for initialization
void Start() {
gameOver = false;
score = 0;
InvokeRepeating ("scoreUpdate", 1.0f, 0.5f);
}
// Update is called once per frame
void Update() {
ScoreText.text = "Score: " + score;
}
void scoreUpdate(){
if(gameOver == false) {
score += 1;
}
}
public void gameOverActivated(){
gameOver = true;
}
public void Play(){
Application.LoadLevel ("level1");
}
public void Pause()
{
if (Time.timeScale == 1)
{
Time.timeScale = 0;
}
else if (Time.timeScale == 0)
{
Time.timeScale = 1;
}
}
public void Replay(){
Application.LoadLevel (Application.loadedLevel);
}
public void Menu (){
Application.LoadLevel ("menu");
}
public void Exit(){
Application.Quit ();
}
}
↧