예제 #1
0
    public IEnumerator HealMana(DataPlayerChange manaBar)
    {
        for (int i = 0; manaBar.GetMana() < 100; i++)
        {
            manaBar.AddMana(5);
            yield return(new WaitForSeconds(1f));

            if (manaBar.GetMana() >= 100)
            {
                manaBar.ResetMana();
                Destroy(gameObject);
            }
        }
    }
    public IEnumerator FireSpell(DataPlayerChange manaBar)
    {
        if (counterSpell == 0)
        {
            if (manaBar.GetMana() >= 30)
            {
                playerAnimator.SetBool("Spell", true);
                manaBar.UseMana(30);
                counterSpell = 1;
                yield return(new WaitForSeconds(0.7f));

                playerAnimator.SetBool("Spell", false);
                if (!playerSprite.flipX)
                {
                    Instantiate(fireSpellRight, spawnFireBallRight.position, spawnFireBallRight.rotation);
                }
                else
                {
                    Instantiate(fireSpellLeft, spawnFireBallLeft.position, spawnFireBallLeft.rotation);
                }
                yield return(new WaitForSeconds(3f));

                counterSpell = 0;
            }
        }
    }
 public void HealRegenTouch(DataPlayerChange manaBar)
 {
     if (counterSpell == 0)
     {
         if ((manaBar.GetMana() > 49) && (manaBar.GetHealth() < 100))
         {
             counterSpell = 1;
             Instantiate(healRegen, spawnZone.position, spawnZone.rotation);
             StartCoroutine(Time());
         }
         else
         {
             return;
         }
     }
     else
     {
         return;
     }
 }
 public void ManaRegenSpell(DataPlayerChange manaBar)
 {
     if (counterSpell == 0)
     {
         if (manaBar.GetMana() < 100)
         {
             counterSpell = 1;
             Instantiate(manaRegenZone, spawnZone.position, spawnZone.rotation);
             StartCoroutine(Time());
         }
         else
         {
             return;
         }
     }
     else
     {
         return;
     }
 }