IEnumerator StartRagdoll(float duration, Ragdoll.ImpactParams param) { AnnouncerSoundManager.Instance.Announce(ANNOUNCEMENT_TYPE.TACKLED); State = STATE.RAGDOLL; EnableRagdoll(); Ragdoll.AddForce(param); if (isOwner) { yield return(new WaitForSeconds(duration)); Debug.Log("Deactivating them ragdoll bois was good"); while (Ragdoll.DistanceToWorld() >= 0.75f) // can trigger mid air atm, check if ray hits ground and not chad { yield return(null); } //Debug.Log("The ground has been reached."); yield return(new WaitForSeconds(1)); State = STATE.CHADING; CurrentVelocity.y = BaseSpeed; } else { yield return(null); } }
private void Health_OnDeath() { Ragdoll.enabled = true; RagdollRoot.SetParent(null); if (_lastDamage != null) { Ragdoll.AddForce(_lastDamage.Point, _lastDamage.Direction * _lastDamage.Damage); } Destroy(Root.gameObject); Destroy(RagdollRoot.gameObject, 10f); }