/// <summary> /// Die and spawn a ragdoll /// </summary> public void Die(Vector3 forceVector, Vector3 forcePoint) { JoeJeffRagdoll rag = Instantiate(ragdollPrefab.gameObject, transform.position, transform.rotation).GetComponent <JoeJeffRagdoll>(); rag.Ragdoll(transform, skeletonRoot, skinColor, rigidbody.velocity, forceVector, forcePoint); Destroy(gameObject); }
/// <summary> /// Die and spawn a ragdoll /// </summary> public void Die(Vector3 forceVector, Vector3 forcePoint) { if (hasDied) { return; // ensure only one ragdoll is spawned. } hasDied = true; JoeJeffRagdoll rag = Instantiate(ragdollPrefab.gameObject, transform.position, transform.rotation).GetComponent <JoeJeffRagdoll>(); rag.Ragdoll(transform, skeletonRoot, skinColor.skinColor, rigidbody.velocity, forceVector, forcePoint); Destroy(gameObject); }