コード例 #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
ファイル: BreakoutGame.cs プロジェクト: webalab/duckstruction
 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");
    }
コード例 #5
0
 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
ファイル: BreakoutGame.cs プロジェクト: webalab/duckstruction
 public void WonGame()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = BreakoutGameState.won;
 }
コード例 #9
0
ファイル: BreakoutGame.cs プロジェクト: webalab/duckstruction
 public void SetGameOver()
 {
     Time.timeScale = 0.0f; //Pause game
     gameState = BreakoutGameState.lost;
 }
コード例 #10
0
ファイル: BreakoutGame.cs プロジェクト: ShipuW/unity-study
 /// <summary>
 /// 游戏胜利
 /// </summary>
 public void WinGame()
 {
     Time.timeScale = 0.0f; //设置游戏暂停.
     gameState = BreakoutGameState.win;
 }
コード例 #11
0
ファイル: BreakoutGame.cs プロジェクト: ShipuW/unity-study
 /// <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");
        }
    }