예제 #1
0
    public void TakeDamage(float damage)
    {
        if (hitTimer > 0.8f)
        {
            characterStats.currentHealth -= damage;
            hitTimer = 0f;
            enemyAnimation.PlayHit();
            hitCor = OnHit();
            StartCoroutine(hitCor);
        }

        if (characterStats.currentHealth <= 0 && !isDead)
        {
            isDead   = true;
            deathCor = OnDeath();
            enemyAnimation.PlayDeath();
            StartCoroutine(deathCor);
        }
    }