Exemple #1
0
    void OnGUI()
    {
        // Display for Whose turn it is and what the turn count is
        GUI.Box(new Rect(Screen.width * 0.0f, Screen.height * 0.85f, 190, 100), ("Turn: " + WhoseTurn() + "\n" + "Turn #: " + TurnCount()), style);

        // Button for Menu
        if (GUI.Button(new Rect(Screen.width * 0f, Screen.height * 0f, 100, 30), "Menu"))
        {
            if (isEnabled)
            {
                isEnabled = false;
            }
            else
            {
                isEnabled = true;
            }
        }

        // Toggle Menu Group
        if (isEnabled)
        {
            // Menu Group
            GUI.BeginGroup(new Rect(Screen.width * 0f, Screen.height * 0.05f, 100, 250));

            // Save button
            if (GUI.Button(new Rect(0, 10, 90, 30), "Save"))
            {
                Debug.Log("Save Button, not implemented.");
            }

            // Load button
            if (GUI.Button(new Rect(0, 50, 90, 30), "Load"))
            {
                Debug.Log("Load Button, not implemented.");
            }

            // Exit button
            if (GUI.Button(new Rect(0, 90, 90, 30), "Exit"))
            {
                Application.LoadLevel("MainMenuGUITest");
            }

            // End Main Menu Group
            GUI.EndGroup();
        }

        if (GUI.Button(new Rect(Screen.width * 0f, Screen.height * 0.75f, 100, 50), "End Turn"))
        {
            if (gameController.AllowPlayerControlledEnemies || gameController.currentTurn == GameControllerBehaviour.UnitSide.player)
            {
                gameController.EndTurn();
            }
        }
    }
Exemple #2
0
    /// <summary>
    /// Iterates over the enemy's squads and selects the first active squad capable of moving.
    /// If all squads have moved, the turn is ended.
    /// </summary>
    public void UpdateState_PickingSquad()
    {
        foreach (ActorBehavior actor in gameController.enemyTeam)
        {
            if (!actor.actorHasMovedThisTurn)
            {
                selectedActor = actor;
                State         = AIState.DetermineMovePoint;

                setCameraTarget(selectedActor.gameObject);

                return;
            }
        }

        State = AIState.WaitingForPlayer;
        setCameraTarget(null);
        gameController.EndTurn();
    }