public void TakeDamage(int damage, Vector3 impactDir) { Vector3 impactForce = impactDir * IMPACT_PUNCH_DIST * damage; if (m_isBroken) { m_rigidbody.AddForce(impactForce + Vector3.up * Random.Range(MIN_BREAK_FORCE, MAX_BREAK_FORCE) * 0.5f, ForceMode.Impulse); } else { m_currentHp -= damage; if (m_currentHp <= 0) { Break(impactDir); if (m_currentTile != null) { m_currentTile.OnPartBreak(this); } } else { Shake(impactForce); } UpdateDamageVisuals(); } }