public IEnumerator Attack(SpellDB.AttackID id, Vector3 to = default(Vector3))
    {
        wizardAnimator.SetBool("Attack", true);
        yield return(new WaitForSeconds(1.0f));

        magicSpell = magicPool[(int)id];

        StartCoroutine(magicSpell.castMagic(gameObject, to));

        Debug.Log("Attack using " + SpellDB.attackIDnames[(int)id]);


        wizardAnimator.SetBool("Attack", false);
    }
示例#2
0
    private IEnumerator AttackByPosition(SpellDB.AttackID id, Vector3 to = default(Vector3))
    {
//		id = SpellDB.AttackID.iceBurst;
        magicSpell = magicPool[(int)id];
        PlayerData pD = GetComponent <PlayerData>();

        if (pD.DecreaseMana(Constants.FIREBALL_MANA_COST))           // TODO Mana cost is constant now
        {
            wizardAnimator.SetBool("isCasting", true);
            yield return(new WaitForSeconds(Constants.MIN_CAST_COOL_DOWN));

            StartCoroutine(magicSpell.castMagic(gameObject, to));

            Debug.Log("[Spell] Attack using " + SpellDB.attackIDnames [(int)id]);

            wizardAnimator.SetBool("isCasting", false);
        }
        else
        {
            Debug.Log("[Spell] not enough mana!");
        }
        yield return(new WaitForSeconds(0.5f));
    }