Exemple #1
0
    IEnumerator Attack()
    {
        if (GameState.isPlaying)
        {
            animator.SetTrigger("attack");
            yield return(new WaitForSeconds(AttackSpeed));

            int attackAnimationCount = 5;
            for (int attackCount = 0; attackCount <= attackAnimationCount; attackCount++)
            {
                playerHealth.Attacked(AttackStrength / attackAnimationCount);
                yield return(new WaitForSeconds(AttackSpeed));
            }
            animator.SetTrigger("idle");
            yield return(new WaitForSeconds(AttackDelay));

            StartCoroutine(Attack());
        }
    }