Example #1
0
    public IEnumerator GetAttack(Pokemon pokemon)
    {
        while (attack == null)
        {
            yield return(null);
        }
        string savedAttack = attack;

        attack = null;
        yield return(StartCoroutine(pokemon.AttackEnemyPokemon(savedAttack)));
    }
Example #2
0
    // circle stuff
    public IEnumerator GetAttack(Pokemon pokemon)
    {
        yield return(new WaitForSeconds(2f));

        animator.enabled = true;
        if (i == 0)
        {
            animator.Play("Ember");
            yield return(StartCoroutine(pokemon.AttackEnemyPokemon("Ember")));

            ember.gameObject.SetActive(true);
            yield return(new WaitForSeconds(3));

            animator.enabled = false;
            ember.gameObject.SetActive(false);
            i++;
        }
        else if (i == 1)
        {
            animator.Play("Flamethrower");
            yield return(StartCoroutine(pokemon.AttackEnemyPokemon("Flamethrower")));

            flamethrower.gameObject.SetActive(true);
            yield return(new WaitForSeconds(3));

            animator.enabled = false;
            flamethrower.gameObject.SetActive(false);
            i++;
        }
        else if (i == 2)
        {
            animator.Play("Itch");
            yield return(new WaitForSeconds(3));

            animator.Play("Idle");
            animator.enabled = false;
            yield return(StartCoroutine(pokemon.AttackEnemyPokemon("Tackle")));

            i = 0;
        }
    }