void OnCollisionEnter(Collision other) { if (!enableRagdolling) { return; } print(other.gameObject); if (other.rigidbody) { var pickable = other.rigidbody.GetComponent <Pickable>(); if (pickable && other.rigidbody.velocity.magnitude >= minVelocityToGetHit) { print(other.rigidbody.velocity); // Gets hit // Instantiate ragdoll friendRagdoll = Instantiate(ragdollPrefab, transform.position, transform.rotation) .GetComponentInChildren <FriendRagdoll>(); friendRagdoll.friendModelToRevive = this; gameObject.SetActive(false); } } }
public void Revive() { friendRagdoll = null; gameObject.SetActive(true); stateMachine.SwitchState(IdleState.Instance); if (Random.Range(0f, 1f) < TaskManager.Instance.hideFriendsTask.godModeProbability) { GodMode(); } else { RestoreShaders(); } }