コード例 #1
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);
        }
    }