예제 #1
0
 //won the level
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState      = BreakoutGameState.won;
     gamestate.Instance.currentLevelComplete = true;
     gamestate.Instance.setActiveLevel(gamestate.Instance.getActiveLevel() + 1);
     Application.LoadLevel("Level" + gamestate.Instance.getActiveLevel() + "CompleteMenu");
 }
예제 #2
0
 void Awake()
 {
     SP = this;
     blocksHit = 0;
     gameState = BreakoutGameState.playing;
     totalBlocks = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
     SpawnBall();
 }
예제 #3
0
 void Awake()
 {
     SP             = this;
     blocksHit      = 0;
     gameState      = BreakoutGameState.playing;
     totalBlocks    = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
     Invoke("SpawnBall", 1);
 }
예제 #4
0
    public void SetGameOver()
    {
        Time.timeScale = 0.0f; //Pause game
        gameState      = BreakoutGameState.lost;

        gamestate.Instance.currentLevelComplete = false;
        gamestate.Instance.IsGameWon            = false;
        Application.LoadLevel("Level" + gamestate.Instance.getActiveLevel() + "CompleteMenu");
    }
 private void Start()
 {
     State = new GameplayState(this);
     CreateUiScreens();
     ResetLives();
     GenerateCurrentLevel();
     ResetGame();
     StartIntroSequence();
 }
예제 #6
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState      = BreakoutGameState.lost;
 }
예제 #7
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState      = BreakoutGameState.won;
 }
예제 #8
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = BreakoutGameState.won;
 }
예제 #9
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = BreakoutGameState.lost;
 }
예제 #10
0
 /// <summary>
 /// 游戏胜利
 /// </summary>
 public void WinGame()
 {
     Time.timeScale = 0.0f; //设置游戏暂停.
     gameState = BreakoutGameState.win;
 }
예제 #11
0
 /// <summary>
 /// 游戏失败 
 /// </summary>
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //设置游戏暂停.
     gameState = BreakoutGameState.lost;
 }
예제 #12
0
    void OnGUI()
    {
        GUILayout.Space(10);
        GUILayout.Label("  Hit: " + blocksHit + "/" + totalBlocks);

        if (gameState == BreakoutGameState.lost)
        {
            GUILayout.Label("You Lost!");
            if (GUILayout.Button("Try again"))
            {
                Application.LoadLevel(Application.loadedLevel);
            }
        }
        else if (gameState == BreakoutGameState.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 = BreakoutGameState.lost;
                paused = true;
            }
            string countText = string.Format("{0:00}:{1:00}:{2:000}", minutes, seconds, miliseconds);
            GUILayout.Label(countText);
            paused = GUILayout.Toggle(paused, "Pause");
        }
    }