Ejemplo n.º 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");
 }
Ejemplo n.º 2
0
 void Awake()
 {
     SP = this;
     blocksHit = 0;
     gameState = BreakoutGameState.playing;
     totalBlocks = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
     SpawnBall();
 }
Ejemplo n.º 3
0
 void Awake()
 {
     SP             = this;
     blocksHit      = 0;
     gameState      = BreakoutGameState.playing;
     totalBlocks    = GameObject.FindGameObjectsWithTag("Pickup").Length;
     Time.timeScale = 1.0f;
     Invoke("SpawnBall", 1);
 }
Ejemplo n.º 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");
    }
Ejemplo n.º 5
0
 private void Start()
 {
     State = new GameplayState(this);
     CreateUiScreens();
     ResetLives();
     GenerateCurrentLevel();
     ResetGame();
     StartIntroSequence();
 }
Ejemplo n.º 6
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState      = BreakoutGameState.lost;
 }
Ejemplo n.º 7
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState      = BreakoutGameState.won;
 }
Ejemplo n.º 8
0
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = BreakoutGameState.won;
 }
Ejemplo n.º 9
0
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = BreakoutGameState.lost;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// 游戏胜利
 /// </summary>
 public void WinGame()
 {
     Time.timeScale = 0.0f; //设置游戏暂停.
     gameState = BreakoutGameState.win;
 }
Ejemplo n.º 11
0
 /// <summary>
 /// 游戏失败 
 /// </summary>
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //设置游戏暂停.
     gameState = BreakoutGameState.lost;
 }
Ejemplo n.º 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");
        }
    }