Example #1
0
    public void AdvanceTurn()
    {
        audioManager.PlayGavel();

        float transitionDuration = 1.0f;

        //alert child ui managers to update their information
        currentTurnUIManager.UpdateTurnDisplay(transitionDuration);

        //prevent the player from triggering this stuff again or undoing any of their actions
        endTurnUIManager.SetEndTurnButtonInteractable(false);

        if (turnManager.NextRound > turnManager.TotalRounds)
        {
            StartCoroutine(EndGame());
        }
        else
        {
            turnManager.AdvanceTurn();

            if (turnManager.CurrentPlayer == turnManager.firstPlayer)
            {
                StartCoroutine(AITurn());
            }
            else
            {
                endTurnUIManager.SetEndTurnButtonInteractable(true);
            }
        }
    }
Example #2
0
    public void AdvanceTurn()
    {
        audioManager.PlayGavel();

        //prevent the player from triggering this stuff again or undoing any of their actions
        endTurnUIManager.SetEndTurnButtonInteractable(false);
        turnManager.BeginTurnTransition();

        if (turnManager.NextRound > turnManager.TotalRounds)
        {
            StartCoroutine(EndGame());
        }
        else
        {
            float transitionDuration = 1.0f;

            //alert child ui managers to update their information
            currentTurnUIManager.UpdateTurnDisplay(transitionDuration);

            //update the background colors of the UI panels
            var nextPlayer            = turnManager.NextPlayer;
            var targetBackgroundColor = GetBackgroundColorForPlayer(nextPlayer);

            foreach (var panel in backgroundPanels)
            {
                LeanTween.color(panel.rectTransform, targetBackgroundColor, transitionDuration);
            }

            //after the transition duration, actually go through with ending the turn
            Invoke("TurnTransitionsFinished", transitionDuration);
        }
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        turnManager          = GameObject.FindGameObjectWithTag("GameController").GetComponent <TurnManager>();
        cityGenerator        = GameObject.FindGameObjectWithTag("GameController").GetComponent <CityGenerator>();
        aiManager            = GameObject.FindGameObjectWithTag("GameController").GetComponent <AIManager>();
        currentTurnUIManager = GetComponentInChildren <CurrentTurnUIManager>();
        endTurnUIManager     = GetComponentInChildren <EndTurnUIManager>();

        audioManager = GameObject.FindGameObjectWithTag("AudioManager").GetComponent <AudioManager>();

        //color the background based on the human player
        var currentBackgroundColor = GetBackgroundColorForPlayer(turnManager.NextPlayer);

        foreach (var panel in backgroundPanels)
        {
            panel.color = currentBackgroundColor;
        }

        endTurnUIManager.SetEndTurnButtonInteractable(false);

        StartCoroutine(AITurn());
    }