예제 #1
0
    void BounceEnemy()
    {
        if (enemy.IsStunned)
        {
            return;
        }

        if (grounded)
        {
            bounceTimer += Time.deltaTime;
            if (bounceTimer > bounceDelay)
            {
                rb.Sleep();

                rb.AddForce(transform.up * bouncePower, ForceMode2D.Impulse);

                //playsound
                if (soundFX)
                {
                    soundFX.PlayAttackSound();
                }

                //anim switch
                if (anim)
                {
                    anim.PlayJump();
                }

                bounceTimer = 0;
            }
        }
    }