private void OnDestroy() { if (LocalPlayer.Transform == base.transform) { LocalPlayer.Transform = null; LocalPlayer.Ridigbody = null; FMOD_StudioEventEmitter.LocalPlayerTransform = null; LocalPlayer.GameObject = null; LocalPlayer.PlayerBase = null; LocalPlayer.HeadTr = null; LocalPlayer.HipsTr = null; LocalPlayer.Inventory = null; LocalPlayer.ReceipeBook = null; LocalPlayer.SpecialActions = null; LocalPlayer.SpecialItems = null; LocalPlayer.MainCamTr = null; LocalPlayer.MainCam = null; LocalPlayer.InventoryCam = null; LocalPlayer.CamFollowHead = null; LocalPlayer.Animator = null; LocalPlayer.AnimControl = null; LocalPlayer.Create = null; LocalPlayer.Tuts = null; LocalPlayer.Sfx = null; LocalPlayer.Stats = null; LocalPlayer.FpCharacter = null; LocalPlayer.FpHeadBob = null; LocalPlayer.CamRotator = null; LocalPlayer.MainRotator = null; LocalPlayer.ScriptSetup = null; LocalPlayer.TargetFunctions = null; LocalPlayer.HitReactions = null; LocalPlayer.Buoyancy = null; LocalPlayer.WaterViz = null; LocalPlayer.AiInfo = null; LocalPlayer.WaterEngine = null; LocalPlayer.ItemDecayMachine = null; LocalPlayer.AnimatedBook = null; LocalPlayer.PassengerManifest = null; LocalPlayer.GreebleRoot = null; LocalPlayer.MudGreeble = null; LocalPlayer.PlayerDeadCam = null; LocalPlayer.PauseMenuBlur = null; LocalPlayer.PauseMenuBlurPsCam = null; LocalPlayer.HeldItemsData = null; LocalPlayer.Vis = null; } }
private void ConvertToVR() { if (ForestVR.Enabled) { Debug.LogWarning("ENABLING VR"); for (int i = 0; i < this.MainCamera.transform.childCount; i++) { this.MainCamera.transform.GetChild(i).SetParent(this.VREyeCamera); } AudioListener componentInChildren = this.MainCamera.GetComponentInChildren <AudioListener>(true); if (componentInChildren) { UnityEngine.Object.Destroy(componentInChildren); } this.MainCamera.SetActive(false); this.VRCameraRig.SetActive(true); this.Player.GetComponent <FirstPersonHeadBob>().enabled = false; this.Player.GetComponent <SimpleMouseRotator>().enabled = false; camFollowHead componentInChildren2 = this.PlayerBase.GetComponentInChildren <camFollowHead>(true); IEnumerator enumerator = this.PlayerMeshesToDisable.transform.GetEnumerator(); try { while (enumerator.MoveNext()) { object obj = enumerator.Current; Transform transform = (Transform)obj; SkinnedMeshRenderer component = transform.GetComponent <SkinnedMeshRenderer>(); if (component) { component.shadowCastingMode = ShadowCastingMode.ShadowsOnly; } } } finally { IDisposable disposable; if ((disposable = (enumerator as IDisposable)) != null) { disposable.Dispose(); } } this.VRPlayerHands.gameObject.SetActive(true); this.VRPlayerHands.shadowCastingMode = ShadowCastingMode.On; this.VRWatchGo.SetActive(true); this.defaultPlayerArms.gameObject.SetActive(false); LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("vrBool").Value = true; } }
private void Awake() { LocalPlayer.Transform = this._transform; LocalPlayer.Ridigbody = this._ridigbody; FMOD_StudioEventEmitter.LocalPlayerTransform = LocalPlayer.Transform; LocalPlayer.GameObject = this._playerGO; LocalPlayer.PlayerBase = this._playerBase; LocalPlayer.HeadTr = this._headTr; LocalPlayer.HipsTr = this._hipsTr; LocalPlayer.Inventory = this._inventory; LocalPlayer.ReceipeBook = this._receipeBook; LocalPlayer.SpecialActions = this._specialActions; LocalPlayer.SpecialItems = this._specialItems; LocalPlayer.MainCamTr = this._mainCamTr; LocalPlayer.MainCam = this._mainCam; LocalPlayer.InventoryCam = this._inventoryCam; LocalPlayer.CamFollowHead = this._camFollowHead; LocalPlayer.Animator = this._animator; LocalPlayer.AnimControl = this._animControl; LocalPlayer.Create = this._create; LocalPlayer.Tuts = this._tuts; LocalPlayer.Sfx = this._sfx; LocalPlayer.Stats = this._stats; LocalPlayer.FpCharacter = this._fpc; LocalPlayer.FpHeadBob = this._fphb; LocalPlayer.CamRotator = this._camRotator; LocalPlayer.MainRotator = this._mainRotator; LocalPlayer.ScriptSetup = this._scriptSetup; LocalPlayer.TargetFunctions = this._targetFunctions; LocalPlayer.HitReactions = this._hitReactions; LocalPlayer.Buoyancy = this._buoyancy; LocalPlayer.WaterViz = this._waterViz; LocalPlayer.AiInfo = this._aiInfo; LocalPlayer.WaterEngine = this._waterEngine; LocalPlayer.ItemDecayMachine = this._itemDecayMachine; LocalPlayer.AnimatedBook = this._animatedBook; LocalPlayer.PassengerManifest = this._passengerManifest; LocalPlayer.GreebleRoot = this._greebleRoot; LocalPlayer.MudGreeble = this._mudGreeble; LocalPlayer.PlayerDeadCam = this._PlayerDeadCam; LocalPlayer.PauseMenuBlur = this._pauseMenuBlur; LocalPlayer.PauseMenuBlurPsCam = this._pauseMenuBlurPsCam; LocalPlayer.HeldItemsData = this._heldItemsData; LocalPlayer.Vis = this._vis; base.StartCoroutine(this.OldSaveCompat()); }
private void Awake() { BleedBehavior.BloodAmount = 0f; BleedBehavior.BloodReductionRatio = 1f; this.explodeHash = Animator.StringToHash("explode"); this.DSpots = GameObject.FindWithTag("DeadSpots").GetComponent<DeadSpotController>(); this.Hud = Scene.HudGui; this.Ocean = GameObject.FindWithTag("Ocean"); this.mutantControl = Scene.MutantControler; this.sceneInfo = Scene.SceneTracker; this.Player = base.gameObject.GetComponent<PlayerInventory>(); this.camFollow = base.GetComponentInChildren<camFollowHead>(); this.hitReaction = base.GetComponent<playerHitReactions>(); this.Atmos = Scene.Atmosphere; this.FrostScript = LocalPlayer.MainCam.GetComponent<Frost>(); this.Tuts = LocalPlayer.Tuts; this.Sfx = LocalPlayer.Sfx; this.animator = LocalPlayer.Animator; this.DyingVision = LocalPlayer.MainCam.GetComponent<Grayscale>(); this.Fullness = 1f; this.bloodPropertyBlock = new MaterialPropertyBlock(); if (!LevelSerializer.IsDeserializing) { CoopPlayerVariations component = base.GetComponent<CoopPlayerVariations>(); this.PlayerVariation = UnityEngine.Random.Range(0, component.Variations.Length); this.PlayerVariationBody = UnityEngine.Random.Range(0, component.BodyMaterials.Length); } if (this.CurrentArmorTypes == null || this.CurrentArmorTypes.Length != this.ArmorModel.Length) { this.CurrentArmorTypes = new PlayerStats.ArmorTypes[this.ArmorModel.Length]; for (int i = 0; i < this.CurrentArmorTypes.Length; i++) { this.CurrentArmorTypes[i] = PlayerStats.ArmorTypes.None; this.ArmorModel[i].SetActive(false); } } if (this.CurrentArmorHP == null || this.CurrentArmorHP.Length != this.ArmorModel.Length) { this.CurrentArmorHP = new int[this.ArmorModel.Length]; } this.CaveDoors = GameObject.FindGameObjectsWithTag("CaveDoor"); }
private void ConvertToVR() { if (ForestVR.Enabled) { Debug.LogWarning("ENABLING VR"); for (int i = 0; i < this.MainCamera.transform.childCount; i++) { this.MainCamera.transform.GetChild(i).SetParent(this.cameraChildOffsetTranform, false); } this.mouthPiece.transform.parent = this.VREyeCamera.transform; this.mouthPiece.transform.localEulerAngles = Vector3.zero; this.mouthPiece.transform.localPosition = new Vector3(0f, -1.78f, 0.008f); AudioListener componentInChildren = this.MainCamera.GetComponentInChildren <AudioListener>(true); if (componentInChildren) { UnityEngine.Object.Destroy(componentInChildren); } FMOD_Listener componentInChildren2 = this.MainCamera.GetComponentInChildren <FMOD_Listener>(true); if (componentInChildren2) { UnityEngine.Object.Destroy(componentInChildren2); } this.MainCamera.SetActive(false); this.VRCameraRig.SetActive(true); this.Player.GetComponent <FirstPersonHeadBob>().enabled = false; this.Player.GetComponent <SimpleMouseRotator>().enabled = false; camFollowHead componentInChildren3 = this.PlayerBase.GetComponentInChildren <camFollowHead>(true); foreach (GameObject gameObject in this.PlayerMeshesToDisable) { SkinnedMeshRenderer[] componentsInChildren = gameObject.GetComponentsInChildren <SkinnedMeshRenderer>(true); foreach (SkinnedMeshRenderer skinnedMeshRenderer in componentsInChildren) { skinnedMeshRenderer.shadowCastingMode = ShadowCastingMode.ShadowsOnly; } } CoopArmorReplicator component = LocalPlayer.Transform.GetComponent <CoopArmorReplicator>(); foreach (GameObject gameObject2 in component.Bones) { MeshRenderer component2 = gameObject2.GetComponent <MeshRenderer>(); if (component2) { component2.enabled = false; } } this.VRPlayerHands.gameObject.SetActive(true); this.VRPlayerHands.shadowCastingMode = ShadowCastingMode.On; this.defaultPlayerArms.gameObject.SetActive(false); LocalPlayer.ScriptSetup.pmControl.FsmVariables.GetFsmBool("vrBool").Value = true; this.JointsOffsetTransform.parent = LocalPlayer.vrPlayerControl.VROffsetTransform; this.heldLogsParentTransform.parent = LocalPlayer.vrAdapter.VREyeCamera.transform; this.heldLogsParentTransform.localPosition = new Vector3(0.053f, -0.409f, -0.0181f); this.heldLogsParentTransform.localEulerAngles = new Vector3(9.855f, -1.221f, 0.205f); this.grassDisplacementGo.SetActive(false); this.heldDeadBodyGo.transform.localPosition = new Vector3(1.22f, -2.99f, 0.49f); } else { this.VRWatchParentGo.SetActive(false); this.HeightScaleGo.SetActive(false); } }