protected virtual void NetGetHit(string bodyPartHit, string hitVector, int damage, int knockbackForce) { Vector3 hitNormal = HelpfulFunctions.StringToVector3(hitVector); if (bodyPartHit == "Eye") { damage = Mathf.RoundToInt(damage * criticalHitMultiplier); audioSource.PlayOneShot(eyeHitSound); } else { audioSource.PlayOneShot(hitSound); } health -= damage; if (health <= 0) { Die(); } if (knockbackEnabled) { rb.AddForce(-hitNormal * knockbackForce, ForceMode.Impulse); rb.AddTorque(hitNormal * knockbackForce, ForceMode.Impulse); } }
void NetProjectileHit(int index, string hitPoint) { if (hitParticles != null) { Vector3 hitVector = HelpfulFunctions.StringToVector3(hitPoint); Instantiate(hitParticles, hitVector, Quaternion.identity); } Destroy(projectiles[index], .5f); }