示例#1
0
    /// <summary>
    /// Applies damage to the player.
    /// </summary>
    /// <param name="damage">Damage value to apply to the player.</param>
    /// <param name="shouldBounce">Should the player bounce off the enemy?</param>
    public bool TakeDamage(int damage, bool shouldBounce)
    {
        if (!m_isInvisible)
        {
            m_health -= damage;
            m_healthBar.SetHealth(m_health);

            m_isInvisible = true;

            m_coroutine = InvisibilityFrames();
            StartCoroutine(m_coroutine);

            PlayerManager.Instance.Source.PlayOneShot(PlayerManager.Instance.OnHit);
        }

        return(m_health > 0);
    }
 void EnemyDamage(int damage)
 {
     currentHealth -= damage;
     healthBar.SetHealth(currentHealth);
 }