예제 #1
0
    private IEnumerator StandardAttack()
    {
        animationController.Play("Attack Animation");

        yield return(new WaitForSeconds(1));

        if (turnController.GetForestConversion())
        {
            damageText.text = "FOREST CONVERSION";

            damageText.enabled = true;

            yield return(new WaitForSeconds(1));

            StartCoroutine(TakeDamage(Random.Range(attackPower - (attackPower / 2), attackPower + (attackPower / 2)), false));

            yield return(new WaitForSeconds(1));

            damageText.enabled = false;

            turnController.SetForestConversion(true);
        }
        else
        {
            chance = Random.Range(1, 3);

            switch (chance)
            {
            case 1:
                paladinController.StartCoroutine(paladinController.TakeDamage(Random.Range(attackPower - (attackPower / 2), attackPower + (attackPower / 2))));
                break;

            case 2:
                valkyrieController.StartCoroutine(valkyrieController.TakeDamage(Random.Range(attackPower - (attackPower / 2), attackPower + (attackPower / 2))));
                break;

            case 3:
                sageController.StartCoroutine(sageController.TakeDamage(Random.Range(attackPower - (attackPower / 2), attackPower + (attackPower / 2))));
                break;
            }
        }
    }
예제 #2
0
    public IEnumerator OnMagic(int selection)
    {
        if (b_isWounded)
        {
            spriteImage.material.color = clear;
            woundedImage.enabled       = false;
        }

        magicImage.enabled         = true;
        spriteImage.material.color = transparent;
        magicSound.Play();

        switch (selection)
        {
        case 1:     //PALADIN
        {
            magicPosition = new Vector2(715, 310);
        }
        break;

        case 2:     //VALKYRIE
        {
            magicPosition = new Vector2(815, 418);
        }
        break;

        case 3:     //SAGE
        {
            magicPosition = new Vector2(815, 210);
        }
        break;
        }

        magicInstance1 = (GameObject)Instantiate(magic1, magicPosition, Quaternion.identity);
        yield return(new WaitForSeconds(0.2f));

        Destroy(magicInstance1);

        magicInstance2 = (GameObject)Instantiate(magic2, magicPosition, Quaternion.identity);
        yield return(new WaitForSeconds(0.2f));

        Destroy(magicInstance2);

        magicInstance3 = (GameObject)Instantiate(magic3, magicPosition, Quaternion.identity);
        yield return(new WaitForSeconds(0.2f));

        Destroy(magicInstance3);

        magicInstance4 = (GameObject)Instantiate(magic4, magicPosition, Quaternion.identity);
        yield return(new WaitForSeconds(0.2f));

        Destroy(magicInstance4);

        yield return(new WaitForSeconds(1));

        switch (selection)
        {
        case 1:     //PALADIN
        {
            paladinController.StartCoroutine(paladinController.GuardUp());
        }
        break;

        case 2:     //VALKYRIE
        {
            StartCoroutine(GuardUp());
        }
        break;

        case 3:     //SAGE
        {
            sageController.StartCoroutine(sageController.GuardUp());
        }
        break;
        }

        magic -= spell1;
        UpdateStats();

        yield return(new WaitForSeconds(1));

        magicImage.enabled         = false;
        spriteImage.material.color = clear;

        if (b_isWounded)
        {
            spriteImage.material.color = transparent;
            woundedImage.enabled       = true;
        }

        turnController.UpdateTurn();
    }
예제 #3
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();
        }
    }