예제 #1
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();
    }