public void BeAttacked(int attackFrom, int damage = 1) { if (m_HealthPoint < 0) { return; } // attack From enemy: 0 // attack From trap: 1 m_HealthPoint -= damage; for (int i = 0; i < maxHealthPoint; i++) { if (i == m_HealthPoint) { healthpoints[i].DeleteUI(); } } if (m_HealthPoint <= 0) { enemies.AllEnemiesStopAttack(); Die(); } else { // play animation m_HoldWeapon = m_Animator.GetBool("HoldWeapon"); m_AudioSource_hurt.Play(); if (attackFrom == 0) { if (!m_HoldWeapon) { m_Animator.Play("Hit01"); } else { m_Animator.Play("Fight_Hit01"); } } else if (attackFrom == 1) { if (!m_HoldWeapon) { m_Animator.Play("Hit02"); } else { m_Animator.Play("Fight_Hit02"); } } } }