private IEnumerator setPickupRoutine()
    {
        if (this.fromMutantRagdoll)
        {
            if (this._rootGo && !BoltNetwork.isClient)
            {
                destroyAfter destroyAfter = this._rootGo.AddComponent <destroyAfter>();
                destroyAfter.destroyTime = 60f;
            }
            GameObject value = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("CutScene/girl_Pickup"), LocalPlayer.PlayerBase.transform.position, LocalPlayer.PlayerBase.transform.rotation);
            LocalPlayer.SpecialActions.SendMessage("setGirlGo", value, SendMessageOptions.DontRequireReceiver);
            LocalPlayer.SpecialActions.SendMessage("setGirlTrigger", base.gameObject, SendMessageOptions.DontRequireReceiver);
            this.ragdollGo.SetActive(false);
        }
        else
        {
            LocalPlayer.SpecialActions.SendMessage("setGirlGo", this.girlGo, SendMessageOptions.DontRequireReceiver);
            LocalPlayer.SpecialActions.SendMessage("setGirlTrigger", base.gameObject, SendMessageOptions.DontRequireReceiver);
        }
        LocalPlayer.SpecialActions.SendMessage("pickupGirlRoutine", base.transform.position, SendMessageOptions.DontRequireReceiver);
        if (BoltNetwork.isRunning)
        {
            base.entity.Freeze(false);
            syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Everyone);
            syncGirlPickup.target         = base.transform.GetComponentInParent <BoltEntity>();
            syncGirlPickup.disableTrigger = true;
            syncGirlPickup.Send();
        }
        base.gameObject.SetActive(false);
        yield return(null);

        yield break;
    }
 private void forceGirlResetFromExplosion()
 {
     base.StopCoroutine("pickupGirlRoutine");
     if (LocalPlayer.AnimControl.holdingGirl)
     {
         LocalPlayer.AnimControl.holdingGirl = false;
         LocalPlayer.Animator.SetBool("girlPickup", false);
         if (this.girlGo)
         {
             Animator componentInChildren = this.girlGo.GetComponentInChildren <Animator>();
             if (componentInChildren)
             {
                 base.StartCoroutine(this.resetGirlAnimation(componentInChildren));
             }
             this.girlGo.SendMessage("enableThisGo", SendMessageOptions.DontRequireReceiver);
             if (this.girlTrigger)
             {
                 this.girlTrigger.SendMessage("resetPickup", SendMessageOptions.DontRequireReceiver);
             }
             syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Everyone);
             syncGirlPickup.target        = this.girlGo.GetComponent <BoltEntity>();
             syncGirlPickup.enableTrigger = true;
             syncGirlPickup.Send();
         }
         else
         {
             this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
             if (this.currState2.shortNameHash != this.putDownGirlHash)
             {
                 if (BoltNetwork.isClient)
                 {
                     syncGirlPickup syncGirlPickup2 = syncGirlPickup.Create(GlobalTargets.Everyone);
                     syncGirlPickup2.target    = base.transform.root.GetComponent <BoltEntity>();
                     syncGirlPickup2.spawnGirl = true;
                     syncGirlPickup2.Send();
                 }
                 else
                 {
                     UnityEngine.Object.Instantiate(Resources.Load("CutScene/girl_Pickup"), LocalPlayer.PlayerBase.transform.position, LocalPlayer.PlayerBase.transform.rotation);
                 }
             }
         }
         this.girlHeld.SetActive(false);
         LocalPlayer.Create.Grabber.gameObject.SetActive(true);
         LocalPlayer.AnimControl.playerHeadCollider.enabled = true;
         LocalPlayer.AnimControl.playerCollider.enabled     = true;
         LocalPlayer.FpCharacter.drinking = false;
         LocalPlayer.FpCharacter.Locked   = false;
         LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.RightHand);
         LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.LeftHand);
         LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("noControl").Value = false;
     }
 }
        private IEnumerator forceGirlReset()
        {
            base.StopCoroutine("pickupGirlRoutine");
            if (LocalPlayer.AnimControl.holdingGirl)
            {
                LocalPlayer.AnimControl.holdingGirl = false;
                LocalPlayer.Animator.SetBool("girlPickup", false);
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                if (this.girlGo)
                {
                    Animator componentInChildren = this.girlGo.GetComponentInChildren <Animator>();
                    if (componentInChildren)
                    {
                        base.StartCoroutine(this.resetGirlAnimation(componentInChildren));
                    }
                    this.girlGo.SendMessage("enableThisGo", SendMessageOptions.DontRequireReceiver);
                    if (this.girlTrigger)
                    {
                        this.girlTrigger.SendMessage("resetPickup", SendMessageOptions.DontRequireReceiver);
                    }
                    syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Everyone);
                    syncGirlPickup.target        = this.girlGo.GetComponent <BoltEntity>();
                    syncGirlPickup.enableTrigger = true;
                    syncGirlPickup.Send();
                }
                else if (this.currState2.shortNameHash != this.putDownGirlHash)
                {
                    if (BoltNetwork.isClient)
                    {
                        syncGirlPickup syncGirlPickup2 = syncGirlPickup.Create(GlobalTargets.Everyone);
                        syncGirlPickup2.target    = base.transform.root.GetComponent <BoltEntity>();
                        syncGirlPickup2.spawnGirl = true;
                        syncGirlPickup2.Send();
                    }
                    else
                    {
                        UnityEngine.Object.Instantiate(Resources.Load("CutScene/girl_Pickup"), LocalPlayer.PlayerBase.transform.position, LocalPlayer.PlayerBase.transform.rotation);
                    }
                }
                this.girlHeld.SetActive(false);
                LocalPlayer.Create.Grabber.gameObject.SetActive(true);
                LocalPlayer.AnimControl.playerHeadCollider.enabled = true;
                LocalPlayer.AnimControl.playerCollider.enabled     = true;
                LocalPlayer.CamFollowHead.lockYCam    = false;
                LocalPlayer.CamFollowHead.smoothLock  = false;
                LocalPlayer.MainRotator.rotationRange = new Vector2(0f, 999f);
                LocalPlayer.MainRotator.enabled       = true;
                LocalPlayer.CamRotator.stopInput      = false;
                LocalPlayer.CamRotator.rotationRange  = new Vector2(LocalPlayer.FpCharacter.minCamRotationRange, 0f);
                LocalPlayer.FpCharacter.Locked        = false;
                LocalPlayer.FpCharacter.drinking      = false;
                LocalPlayer.FpCharacter.CanJump       = true;
                LocalPlayer.Rigidbody.isKinematic     = false;
                LocalPlayer.AnimControl.animEvents.StartCoroutine("smoothEnableSpine");
                LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.RightHand);
                LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                yield return(null);

                LocalPlayer.Inventory.HideAllEquiped(false, false);
                yield return(null);

                LocalPlayer.Inventory.ShowAllEquiped(true);
                LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("noControl").Value = false;
                LocalPlayer.ScriptSetup.forceLocalPos.enabled = true;
            }
            yield break;
        }
        public IEnumerator girlToMachineRoutine(Transform pos)
        {
            Vector3 fixLocalPos = new Vector3(0f, -2.344841f, 0f);

            if (!this.spectator)
            {
                LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                LocalPlayer.ScriptSetup.forceLocalPos.enabled = false;
                this.ActorAnimator = LocalPlayer.Animator;
                this.enablePlayerLocked();
            }
            Vector3 playerPos = pos.position;

            playerPos.y += 2.35f;
            float t = 0f;

            while (t < 1f)
            {
                if (!this.spectator)
                {
                    LocalPlayer.Transform.position = Vector3.Slerp(LocalPlayer.Transform.position, playerPos, t);
                    LocalPlayer.Transform.rotation = Quaternion.Slerp(LocalPlayer.Transform.rotation, pos.rotation, t);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                }
                t += Time.deltaTime;
                yield return(null);
            }
            if (!this.spectator)
            {
                LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                LocalPlayer.Transform.position = playerPos;
                LocalPlayer.Transform.rotation = pos.rotation;
                LocalPlayer.PlayerBase.transform.localPosition = fixLocalPos;
                LocalPlayer.ScriptSetup.forceLocalPos.enabled  = false;
                LocalPlayer.AnimControl.endGameCutScene        = true;
                LocalPlayer.vrPlayerControl.useGhostMode       = true;
                LocalPlayer.vrPlayerControl.gameObject.SendMessage("useSteppedGhostMode");
                LocalPlayer.vrPlayerControl.gameObject.SendMessage("setVrStandPos1", LocalPlayer.vrAdapter.overShoulderCamPos, SendMessageOptions.DontRequireReceiver);
                LocalPlayer.AnimControl.useRootMotion = true;
                LocalPlayer.Inventory.UnequipItemAtSlot(Item.EquipmentSlot.Chest, false, true, false);
                LocalPlayer.Animator.SetBool("toMachine", true);
                this.girlHeld.SetActive(false);
            }
            if (!this.spectator)
            {
                syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.OnlyServer);
                syncGirlPickup.dedicatedSpawn = true;
                syncGirlPickup.spawnPos       = this.ActorAnimator.transform.position;
                syncGirlPickup.spawnRot       = this.ActorAnimator.transform.rotation;
                syncGirlPickup.Send();
            }
            GameObject spawn;
            Animator   girlAnimator;

            if (!BoltNetwork.isRunning)
            {
                spawn = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("CutScene/girl_NoPickup"), this.ActorAnimator.transform.position, this.ActorAnimator.transform.rotation);
                yield return(null);

                yield return(null);

                yield return(null);

                yield return(null);

                syncGirlPickup ev = syncGirlPickup.Create(GlobalTargets.Everyone);
                ev.target    = spawn.GetComponent <BoltEntity>();
                ev.toMachine = true;
                ev.Send();
                girlAnimator = spawn.GetComponentInChildren <Animator>();
                enableWithDelay ewd = spawn.GetComponent <enableWithDelay>();
                if (ewd)
                {
                    ewd.enabled = false;
                }
                girlAnimator.enabled = true;
                girlAnimator.CrossFade("Base Layer.girlToMachine", 0f, 0, 0f);
            }
            else
            {
                spawn        = null;
                girlAnimator = null;
            }
            this.currState2 = this.ActorAnimator.GetCurrentAnimatorStateInfo(2);
            while (this.currState2.shortNameHash != this.girlToMachineHash)
            {
                this.currState2 = this.ActorAnimator.GetCurrentAnimatorStateInfo(2);
                if (!this.spectator)
                {
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                    LocalPlayer.Rigidbody.velocity = Vector3.zero;
                    LocalPlayer.PlayerBase.transform.localPosition = fixLocalPos;
                    LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                }
                if (this.currState2.shortNameHash == this.girlToMachineHash)
                {
                    break;
                }
                yield return(null);
            }
            if (!BoltNetwork.isClient && !this.spectator)
            {
                if (girlAnimator != null)
                {
                    girlAnimator.CrossFade("Base Layer.girlToMachine", 0f, 0, this.currState2.normalizedTime);
                }
                if (spawn != null)
                {
                    spawn.transform.position = this.ActorAnimator.transform.position;
                }
            }
            if (!this.spectator)
            {
                LocalPlayer.Animator.SetBool("girlPickup", false);
            }
            bool spawnKey = false;

            while (this.currState2.shortNameHash == this.girlToMachineHash)
            {
                if (!this.spectator)
                {
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                    if (this.currState2.normalizedTime > 0.328f && !spawnKey && !BoltNetwork.isClient)
                    {
                        if (girlAnimator)
                        {
                            girlAnimator.transform.SendMessage("doEnableGo", SendMessageOptions.DontRequireReceiver);
                        }
                        spawnKey = true;
                    }
                    LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                }
                this.currState2 = this.ActorAnimator.GetCurrentAnimatorStateInfo(2);
                yield return(null);
            }
            if (!this.spectator)
            {
                this.disablePlayerLocked();
                LocalPlayer.Inventory.UnlockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                LocalPlayer.AnimControl.useRootMotion         = false;
                LocalPlayer.AnimControl.useRootRotation       = false;
                LocalPlayer.AnimControl.holdingGirl           = false;
                LocalPlayer.AnimControl.endGameCutScene       = false;
                LocalPlayer.vrPlayerControl.useGhostMode      = false;
                LocalPlayer.ScriptSetup.forceLocalPos.enabled = true;
                LocalPlayer.Inventory.EquipPreviousWeapon(true);
                LocalPlayer.Inventory.ShowAllEquiped(true);
                float timer = 0f;
                while (timer < 1f)
                {
                    LocalPlayer.CamFollowHead.transform.localRotation = Quaternion.Lerp(LocalPlayer.CamFollowHead.transform.localRotation, LocalPlayer.CamFollowHead.transform.parent.localRotation, timer);
                    timer += Time.deltaTime * 3f;
                    yield return(null);
                }
            }
            yield break;
        }
        public IEnumerator pickupGirlRoutine(Vector3 pos)
        {
            this.enablePlayerLocked();
            LocalPlayer.Animator.SetBool("girlPickup", true);
            this.girlGo.transform.position = LocalPlayer.PlayerBase.transform.position;
            this.girlGo.transform.rotation = LocalPlayer.PlayerBase.transform.rotation;
            float timer = 0f;

            this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
            while (this.currState2.shortNameHash != this.idleToGirlHash)
            {
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                LocalPlayer.Rigidbody.velocity = Vector3.zero;
                this.girlGo.transform.position = LocalPlayer.PlayerBase.transform.position;
                this.girlGo.transform.rotation = LocalPlayer.PlayerBase.transform.rotation;
                if (this.currState2.shortNameHash == this.idleToGirlHash)
                {
                    break;
                }
                yield return(null);
            }
            Animator girlAnimator = this.girlGo.GetComponentInChildren <Animator>();

            girlAnimator.enabled = true;
            if (BoltNetwork.isRunning)
            {
                syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Others);
                syncGirlPickup.playerTarget        = base.transform.root.GetComponent <BoltEntity>();
                syncGirlPickup.target              = this.girlGo.GetComponent <BoltEntity>();
                syncGirlPickup.syncPickupAnimation = true;
                syncGirlPickup.Send();
            }
            while (this.currState2.shortNameHash == this.idleToGirlHash)
            {
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                girlAnimator.Play("Base Layer.girlPickup", 0, this.currState2.normalizedTime);
                yield return(null);
            }
            girlAnimator.CrossFade("Base Layer.girlPickup", 0f, 0, 1f);
            if (this.girlGo)
            {
                this.girlHeld.SetActive(true);
                this.girlHeld.transform.parent = LocalPlayer.ScriptSetup.spine3.transform;
                if (!BoltNetwork.isRunning || this.girlGo.GetComponent <BoltEntity>().isOwner)
                {
                    UnityEngine.Object.Destroy(this.girlGo);
                }
                else
                {
                    syncGirlPickup syncGirlPickup2 = syncGirlPickup.Create(GlobalTargets.Others);
                    syncGirlPickup2.target        = this.girlGo.GetComponent <BoltEntity>();
                    syncGirlPickup2.destroyPickup = true;
                    syncGirlPickup2.Send();
                    this.girlGo = null;
                }
                this.disablePlayerLocked();
                timer = 0f;
                while (timer < 1f)
                {
                    LocalPlayer.CamFollowHead.transform.localRotation = Quaternion.Lerp(LocalPlayer.CamFollowHead.transform.localRotation, LocalPlayer.CamFollowHead.transform.parent.localRotation, timer);
                    timer += Time.deltaTime * 3f;
                    yield return(null);
                }
                while (this.currState2.shortNameHash == this.girlIdleHash)
                {
                    LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                    this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.RightHand);
                    LocalPlayer.Inventory.LockEquipmentSlot(Item.EquipmentSlot.LeftHand);
                    if (FirstPersonCharacter.GetDropInput() || (ForestVR.Enabled && TheForest.Utils.Input.GetButtonDown("Fire1")))
                    {
                        if (LocalPlayer.Animator.GetCurrentAnimatorStateInfo(0).tagHash == this.idleHash && !LocalPlayer.AnimControl.onRope && !LocalPlayer.AnimControl.onRaft && LocalPlayer.FpCharacter.Grounded && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Book && LocalPlayer.Inventory.CurrentView != PlayerInventory.PlayerViews.Inventory)
                        {
                            base.StartCoroutine(this.putDownGirlRoutine());
                            yield break;
                        }
                        yield return(null);
                    }
                    yield return(null);
                }
            }
            else
            {
                LocalPlayer.Animator.SetBool("girlPickup", false);
                this.disablePlayerLocked();
                LocalPlayer.AnimControl.holdingGirl = false;
                LocalPlayer.Inventory.EquipPreviousWeapon(true);
                LocalPlayer.Inventory.ShowAllEquiped(true);
            }
            yield break;
        }
        public IEnumerator putDownGirlRoutine()
        {
            this.enablePlayerLocked();
            LocalPlayer.Animator.SetBool("girlPickup", false);
            this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
            while (this.currState2.shortNameHash != this.putDownGirlHash)
            {
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                LocalPlayer.Rigidbody.velocity = Vector3.zero;
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                if (this.currState2.shortNameHash == this.putDownGirlHash)
                {
                    break;
                }
                yield return(null);
            }
            if (BoltNetwork.isClient)
            {
                syncGirlPickup syncGirlPickup = syncGirlPickup.Create(GlobalTargets.Everyone);
                syncGirlPickup.target               = base.transform.root.GetComponent <BoltEntity>();
                syncGirlPickup.playerTarget         = base.transform.root.GetComponent <BoltEntity>();
                syncGirlPickup.spawnGirl            = true;
                syncGirlPickup.syncPutDownAnimation = true;
                syncGirlPickup.Send();
            }
            else
            {
                CoopSyncGirlPickupToken coopSyncGirlPickupToken = new CoopSyncGirlPickupToken();
                coopSyncGirlPickupToken.putDown      = true;
                coopSyncGirlPickupToken.pickup       = false;
                coopSyncGirlPickupToken.playerTarget = base.transform.root.GetComponent <BoltEntity>();
                GameObject gameObject;
                if (BoltNetwork.isRunning)
                {
                    gameObject = BoltNetwork.Instantiate(Resources.Load("CutScene/girl_Pickup") as GameObject, coopSyncGirlPickupToken, LocalPlayer.PlayerBase.transform.position, LocalPlayer.PlayerBase.transform.rotation).gameObject;
                }
                else
                {
                    gameObject = (GameObject)UnityEngine.Object.Instantiate(Resources.Load("CutScene/girl_Pickup"), LocalPlayer.PlayerBase.transform.position, LocalPlayer.PlayerBase.transform.rotation);
                }
                Animator componentInChildren = gameObject.GetComponentInChildren <Animator>();
                componentInChildren.enabled = true;
                componentInChildren.CrossFade("Base Layer.putDownGirl", 0f, 0, this.currState2.normalizedTime);
            }
            this.girlHeld.SetActive(false);
            while (this.currState2.shortNameHash == this.putDownGirlHash)
            {
                LocalPlayer.Animator.SetLayerWeightReflected(3, 0f);
                this.currState2 = LocalPlayer.Animator.GetCurrentAnimatorStateInfo(2);
                yield return(null);
            }
            this.disablePlayerLocked();
            LocalPlayer.AnimControl.holdingGirl = false;
            LocalPlayer.Inventory.EquipPreviousWeapon(true);
            LocalPlayer.Inventory.ShowAllEquiped(true);
            float timer = 0f;

            while (timer < 1f)
            {
                LocalPlayer.CamFollowHead.transform.localRotation = Quaternion.Lerp(LocalPlayer.CamFollowHead.transform.localRotation, LocalPlayer.CamFollowHead.transform.parent.localRotation, timer);
                timer += Time.deltaTime * 3f;
                yield return(null);
            }
            yield break;
        }