Esempio n. 1
0
 void Awake()
 {
     SP             = this;
     foundGems      = 0;
     gameState      = MarbleGameState.playing;
     totalGems      = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
 }
Esempio n. 2
0
 void Awake()
 {
     SP = this;
     foundGems = 0;
     gameState = MarbleGameState.playing;
     totalGems = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
 }
Esempio n. 3
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = MarbleGameState.won;
 }
Esempio n. 4
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = MarbleGameState.lost;
 }
Esempio n. 5
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f;         //Pause game
     gameState      = MarbleGameState.lost;
 }
Esempio n. 6
0
 public void WonGame()
 {
     Time.timeScale = 0.0f;         //Pause game
     gameState      = MarbleGameState.won;
 }
    void OnGUI()
    {
        GUILayout.Label(" Found gems: "+foundGems+"/"+totalGems );

        if (gameState == MarbleGameState.lost)
        {
            GUILayout.Label("You Lost!");
            if(GUILayout.Button("Try again") ){
                Application.LoadLevel(Application.loadedLevel);
            }
        }
        else if (gameState == MarbleGameState.won)
        {
            GUILayout.Label("You won!");
            if(GUILayout.Button("Play again") ){
                Application.LoadLevel(Application.loadedLevel);
            }
        }
        else
        {
            float curCount = maxTime - (Time.time - startTime),
                minutes = curCount / 60,
                seconds = curCount % 60,
                miliseconds = (curCount * 100) % 100;
            if (curCount <= 0)
            {
                gameState = MarbleGameState.lost;
                paused = true;
            }
            string countText = string.Format("{0:00}:{1:00}:{2:000}", minutes, seconds, miliseconds);
            GUILayout.Label(countText);
            paused = GUILayout.Toggle(paused, "Pause");
        }
    }