예제 #1
0
    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);
            }
        }
    }
예제 #2
0
    public void Revive()
    {
        friendRagdoll = null;

        gameObject.SetActive(true);
        stateMachine.SwitchState(IdleState.Instance);

        if (Random.Range(0f, 1f) < TaskManager.Instance.hideFriendsTask.godModeProbability)
        {
            GodMode();
        }
        else
        {
            RestoreShaders();
        }
    }