Ejemplo n.º 1
0
    // Update is called once per frame
    void OnGUI()
    {
        if (GUI.Button(new Rect(0, 0, buttonX, buttonY), "Restart"))
        {
            action.Restart();
        }
        FirstController.GameState state = action.GetGameState();
        var labelStyle = new GUIStyle();

        labelStyle.fontSize = 50;
        if (state == FirstController.GameState.Win)
        {
            GUI.Label(new Rect(gridX, 0, 200, 100), "YOU WIN !");
        }
        else if (state == FirstController.GameState.Lose)
        {
            GUI.Label(new Rect(gridX, 0, 200, 100), "YOU LOSE !");
        }
        else
        {
            bool isAnimating = state == FirstController.GameState.Animating;
            GUI.enabled = !isAnimating;
            // continueing...
            if (GUI.Button(new Rect(0, gridY, buttonX, buttonY), "Send a devil to boat"))
            {
                action.DevilUpBoat();
            }
            if (GUI.Button(new Rect(gridX, gridY, buttonX, buttonY), "Send a priest to boat"))
            {
                action.PriestUpBoat();
            }
            if (GUI.Button(new Rect(2 * gridX, gridY, buttonX, buttonY), "Let a devil leave boat"))
            {
                action.DevilDownBoat();
            }
            if (GUI.Button(new Rect(3 * gridX, gridY, buttonX, buttonY), "Let a priest leave boat"))
            {
                action.PriestDownBoat();
            }
            if (GUI.Button(new Rect(0, 2 * gridY, buttonX, buttonY), "GO !"))
            {
                action.BootBoat();
            }
        }
    }
Ejemplo n.º 2
0
 // Update is called once per frame
 void OnGUI()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         action.RestartGame();
     }
     FirstController.GameState gameState = action.GetGameState();
     if (gameState == FirstController.GameState.Lose)
     {
         GUIStyle style = new GUIStyle();
         style.fontSize = 40;
         GUI.Label(new Rect(0, 0, 600, 100), "YOU ARE DEAD", style);
         if (GUI.Button(new Rect(0, 100, 100, 50), "RESART!"))
         {
             action.RestartGame();
         }
     }
 }