예제 #1
0
파일: score.cs 프로젝트: CKY1015/Unity3D
 void Awake()
 {
     SP             = this;
     foundGems      = 0;
     gameState      = MarbleGameState.playing;
     totalGems      = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
 }
예제 #2
0
 void Awake()
 {
     SP = this;
     foundGems = 0;
     gameState = MarbleGameState.playing;
     totalGems = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
 }
예제 #3
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = MarbleGameState.won;
 }
예제 #4
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = MarbleGameState.lost;
 }
예제 #5
0
파일: score.cs 프로젝트: CKY1015/Unity3D
 public void SetGameOver()
 {
     Time.timeScale = 0.0f;         //Pause game
     gameState      = MarbleGameState.lost;
 }
예제 #6
0
파일: score.cs 프로젝트: CKY1015/Unity3D
 public void WonGame()
 {
     Time.timeScale = 0.0f;         //Pause game
     gameState      = MarbleGameState.won;
 }
예제 #7
0
    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");
        }
    }