Example #1
0
    public void UpdateTurn()
    {
        currentTurn++;
        rounds++;

        if (currentTurn == Turn.TOTAL_TURNS)
        {
            currentTurn = Turn.PALADIN;
        }

        magicButtonSelected  = false;
        potionButtonSelected = false;
        manaButtonSelected   = false;

        if (paladinController.IsGuardUp())
        {
            paladinController.setGuardUpImage(false);
        }

        if (valkyrieController.IsGuardUp())
        {
            valkyrieController.setGuardUpImage(false);
        }

        if (sageController.IsGuardUp())
        {
            sageController.setGuardUpImage(false);
        }

        if (currentTurn == Turn.PALADIN)
        {
            if (paladinController.isDead())
            {
                paladinController.StartCoroutine(paladinController.OnDead());
            }

            if (paladinController.GetIsPetrified())
            {
                EnableAllButtons(false);
                StartCoroutine(ShowPetrificationStatus(1));
            }

            if (paladinController.IsGuardUp())
            {
                paladinController.setGuardUpImage(true);
            }
        }

        if (currentTurn == Turn.VALKYRIE)
        {
            if (valkyrieController.isDead())
            {
                valkyrieController.StartCoroutine(valkyrieController.OnDead());
            }

            if (valkyrieController.GetIsPetrified())
            {
                EnableAllButtons(false);
                StartCoroutine(ShowPetrificationStatus(2));
            }

            if (valkyrieController.IsGuardUp())
            {
                valkyrieController.setGuardUpImage(true);
            }
        }

        if (currentTurn == Turn.SAGE)
        {
            if (sageController.isDead())
            {
                sageController.StartCoroutine(sageController.OnDead());
            }

            if (sageController.GetIsPetrified())
            {
                EnableAllButtons(false);
                StartCoroutine(ShowPetrificationStatus(3));
            }

            if (sageController.IsGuardUp())
            {
                sageController.setGuardUpImage(true);
            }
        }

        EnableAllButtons(true);



        switch (currentTurn)
        {
        case Turn.PALADIN:
        {
            stateText.text = "PALADIN'S TURN";
            paladinPortraitRenderer.enabled  = true;
            valkyriePortraitRenderer.enabled = false;
            sagePortraitRenderer.enabled     = false;
        }
        break;

        case Turn.VALKYRIE:
        {
            stateText.text = "VALKYRIE'S TURN";
            paladinPortraitRenderer.enabled  = false;
            valkyriePortraitRenderer.enabled = true;
            sagePortraitRenderer.enabled     = false;
        }
        break;

        case Turn.SAGE:
        {
            stateText.text = "SAGE'S TURN";
            paladinPortraitRenderer.enabled  = false;
            valkyriePortraitRenderer.enabled = false;
            sagePortraitRenderer.enabled     = true;
        }
        break;

        case Turn.ENEMY:
        {
            stateText.text = "CYCLOP'S TURN";
            paladinPortraitRenderer.enabled  = false;
            valkyriePortraitRenderer.enabled = false;
            sagePortraitRenderer.enabled     = false;
            EnableAllButtons(false);

            enemyController.StartCoroutine(enemyController.DecideAction());
        }
        break;
        }

        if (FAST_PLAY)
        {
            FastPlay();
        }

        if (enemyController.GetHealth() <= 0)
        {
            EndGame();
        }
    }