public void TakeDamage(DamageInfo damageInfo) { if (isDead && damageInfo.hitTarget) { Rigidbody target = damageInfo.hitTarget.GetComponent <Rigidbody>(); if (target) { target.GetComponent <Rigidbody>().AddForce( (damageInfo.GetDamageDirection(transform) * -5) + (Vector3.up * 10), ForceMode.VelocityChange ); } } //animator.SetTrigger("GetHit" + damageInfo.GetOrthagonalDirectionName(transform)); float damageAmount = damageInfo.damageAmount; if (damageInfo.hitTarget) { string hitTarget = damageInfo.hitTarget.name; gameManager.UnitHit(this, skeletonControl.GetPart(hitTarget)); damageAmount = skeletonControl.HitPart(hitTarget, damageInfo); } hitPoint -= damageAmount; if (!isDead && hitPoint < 0) { skeletonControl.SwitchToRagdoll( damageInfo.GetDamageDirection(transform), damageInfo.hitTarget ); if (damageInfo.attacker) { damageInfo.attacker.AttackResults("Kill", this); } Die(); } else { if (damageInfo.attacker) { damageInfo.attacker.AttackResults("Hit", this); } } repairCoolDown = repairCoolDownTime; }