public override void ConstantUpdate() { base.ConstantUpdate(); if (!this.m_Active) { return; } Player player = Player.Get(); if (player.IsDead() || SwimController.Get().IsActive() || player.m_DreamActive) { this.Deactivate(false); return; } if (BodyInspectionMiniGameController.Get().IsActive()) { this.Deactivate(false); return; } if (CutscenesManager.Get().IsCutscenePlaying()) { this.Deactivate(false); return; } if (Input.GetMouseButtonDown(0)) { this.Execute(); this.m_Active = false; base.Show(false); } }
public void UpdateWTActivity() { if (!this.IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !ScenarioManager.Get().IsDreamOrPreDream() && this.m_WalkieTalkieObject && this.m_WalkieTalkieObject.activeSelf) { this.m_WalkieTalkieObject.SetActive(false); } }
public void Update() { if (!this.m_EndDemo && Input.GetKey(KeyCode.RightControl) && Input.GetKeyDown(KeyCode.G)) { PlayableDirector cutscene = CutscenesManager.Get().GetCutscene("DemoEnd_Cutscene"); cutscene.transform.rotation = Player.Get().transform.rotation; cutscene.transform.position = Player.Get().transform.position; Item currentItem = Player.Get().GetCurrentItem(Hand.Right); if (currentItem != null) { Player.Get().SetWantedItem(Hand.Right, null, true); InventoryBackpack.Get().InsertItem(currentItem, null, null, true, true, true, true, true); } currentItem = Player.Get().GetCurrentItem(Hand.Left); if (currentItem != null) { Player.Get().SetWantedItem(Hand.Left, null, true); InventoryBackpack.Get().InsertItem(currentItem, null, null, true, true, true, true, true); } Player.Get().BlockMoves(); Player.Get().BlockRotation(); PlayableDirector cutscene2 = CutscenesManager.Get().GetCutscene("DemoEnd_Cutscene"); this.m_CutsceneDuration = (float)cutscene2.duration - 4.5f; CutscenesManager.Get().PlayCutscene("DemoEnd_Cutscene"); this.m_StartCutsceneTime = Time.time; this.m_EndDemo = true; Player.Get().StartController(PlayerControllerType.PlayerCutscene); } if (this.m_EndDemo) { if (!this.m_FirstHit && Time.time - this.m_StartCutsceneTime >= this.m_FirstHitTime) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); PlayerConditionModule.Get().DecreaseEnergy(PlayerConditionModule.Get().GetEnergy() * 0.5f); this.m_FirstHit = true; } if (!this.m_SecondHit && Time.time - this.m_StartCutsceneTime >= this.m_SecondHitTime) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.TwitchDemo); HUDEndDemo.Get().gameObject.SetActive(false); this.m_SecondHit = true; } if (this.m_SecondHit) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, 1f); } if (Time.time - this.m_StartCutsceneTime >= this.m_CutsceneDuration) { HUDManager.Get().ShowDemoEnd(); this.m_EndDemo = true; } } }
protected override void OnEnable() { base.OnEnable(); this.m_Animator.SetInteger(this.m_DeathTypeHash, (int)this.m_DeathType); DialogsManager.Get().StopDialog(); CutscenesManager.Get().StopCutscene(); AIManager.Get().OnPlayerDie(); if (this.m_DeathType == DeathController.DeathType.UnderWater) { PlayerAudioModule.Get().PlayUnderwaterDeathSound(); } else { PlayerAudioModule.Get().PlayDeathSound(); } this.SetState(DeathController.DeathState.Dying); this.m_DeathTime = new float?(Time.time); }
public override void ControllerUpdate() { base.ControllerUpdate(); this.UpdateState(); if (CutscenesManager.Get().IsCutscenePlaying() && (this.m_State == ItemController.State.Aim || this.m_State == ItemController.State.StoneAim)) { if (this.m_Item.m_Info.IsStone()) { InventoryBackpack.Get().InsertItem(this.m_Item, null, null, true, true, true, true, true); Player.Get().SetWantedItem(Hand.Right, null, true); } this.SetState(ItemController.State.None); } if (this.m_Player.GetCurrentItem(Hand.Right) == null) { this.Stop(); } }
private void LateUpdate() { if (CutscenesManager.Get() == null) { return; } float effectiveDeltaTime = this.GetEffectiveDeltaTime(false); if (this.m_UpdateMethod == CinemachineBrain.UpdateMethod.SmartUpdate) { this.UpdateVirtualCameras(CinemachineCore.UpdateFilter.Late, effectiveDeltaTime); } else if (this.m_UpdateMethod == CinemachineBrain.UpdateMethod.LateUpdate) { this.UpdateVirtualCameras(CinemachineCore.UpdateFilter.ForcedLate, effectiveDeltaTime); } this.ProcessActiveCamera(this.GetEffectiveDeltaTime(false)); }
protected override void OnEnable() { base.OnEnable(); if (this.m_Player.GetComponent <PlayerConditionModule>().IsOxygenCriticalLevel()) { this.m_Animator.SetBool(this.m_IsDeadUnderwaterHash, true); } else { this.m_Animator.SetBool(this.m_IsDeadHash, true); } DialogsManager.Get().StopDialog(); CutscenesManager.Get().StopCutscene(); AIManager.Get().OnPlayerDie(); if (this.m_Player.ShouldSwim() && this.m_Player.GetComponent <SwimController>().m_State == SwimState.Dive) { PlayerAudioModule.Get().PlayUnderwaterDeathSound(); } else { PlayerAudioModule.Get().PlayDeathSound(); } this.SetState(DeathController.DeathState.Dying); }
protected override bool ShouldShow() { return(this.m_Datas.Count > 0 && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !ScenarioManager.Get().IsDreamOrPreDream()); }
private void UpdateBestTrigger() { if (HUDReadableItem.Get() != null && HUDReadableItem.Get().enabled) { this.ResetTrigger(); return; } if (this.m_CameraMain == null) { this.ResetTrigger(); this.m_CameraMain = Camera.main; return; } if (CutscenesManager.Get().IsCutscenePlaying()) { this.ResetTrigger(); return; } if (MakeFireController.Get().IsActive() && (MakeFireController.Get().ShouldBlockTriggers() || !Inventory3DManager.Get().gameObject.activeSelf)) { this.ResetTrigger(); return; } if (CraftingController.Get().IsActive() && CraftingController.Get().m_InProgress) { this.ResetTrigger(); return; } if (this.m_Player.m_ActiveFightController && (this.m_Player.m_ActiveFightController.IsBlock() || this.m_Player.m_ActiveFightController.IsAttack())) { this.ResetTrigger(); return; } if (VomitingController.Get().IsActive()) { this.ResetTrigger(); return; } if (HUDItem.Get().m_Active&& HUDItem.Get().m_Item) { this.SetBestTrigger(HUDItem.Get().m_Item, HUDItem.Get().m_Item.transform.position); return; } if (Inventory3DManager.Get().gameObject.activeSelf) { if (!Inventory3DManager.Get().m_FocusedItem) { this.ResetTrigger(); return; } if (BodyInspectionController.Get().IsActive() && Inventory3DManager.Get().m_FocusedItem.IsStorage()) { this.ResetTrigger(); return; } this.SetBestTrigger(Inventory3DManager.Get().m_FocusedItem, Inventory3DManager.Get().m_FocusedItem.transform.position); return; } else { if (BodyInspectionController.Get().IsActive()) { this.ResetTrigger(); return; } if (Player.Get().m_Aim) { this.ResetTrigger(); return; } if (HUDWheel.Get().m_Active) { this.ResetTrigger(); return; } if (this.m_Animator.GetBool(Player.Get().m_CleanUpHash)) { this.ResetTrigger(); return; } if (this.m_Animator.GetBool(TriggerController.Get().m_BDrinkWater)) { this.ResetTrigger(); return; } if (WeaponSpearController.Get().IsActive() && WeaponSpearController.Get().m_ItemBody) { this.SetBestTrigger(WeaponSpearController.Get().m_ItemBody, WeaponSpearController.Get().m_ItemBody.transform.position); return; } TriggerController.s_AllPotentialTriggers.Clear(); TriggerController.s_OffCrosshairTriggers.Clear(); TriggerController.s_ColldersEnabledMap.Clear(); Vector3 crossHairOrigin = this.GetCrossHairOrigin(); Vector3 position = Player.Get().transform.position; float num = 0.8f; float num2 = -1f; float num3 = -1f; float num4 = float.MinValue; Vector3 vector = Vector3.zero; Vector3 vector2 = Vector3.zero; TriggersManager triggersManager = TriggersManager.Get(); bool flag = false; Trigger trigger = null; Vector3 hit_pos = Vector3.zero; Trigger trigger2 = null; Vector3 hit_pos2 = Vector3.zero; float num5 = float.MinValue; HashSet <Trigger> .Enumerator enumerator = triggersManager.GetActiveTriggers().GetEnumerator(); Item currentItem = Player.Get().GetCurrentItem(); while (enumerator.MoveNext()) { Trigger trigger3 = enumerator.Current; if (trigger3 != null && trigger3.enabled && !trigger3.m_IsCut && trigger3.m_Initialized && trigger3.CanTrigger() && (!currentItem || currentItem.GetInfoID() != ItemID.Fire || trigger3.IsFIrecamp() || trigger3.IsCharcoalFurnace() || trigger3.IsForge())) { Collider collider = null; trigger3.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider = TriggerController.s_ColliderCache[0]; } if (collider != null) { if (trigger3.CheckInsideCollider() && collider.bounds.Contains(this.m_CameraMain.transform.position) && trigger3.IsAdditionalTrigger() && (!trigger3.CheckDot() || num4 > num3)) { hit_pos2 = collider.bounds.center; trigger2 = trigger3; num3 = num4; } float num6 = (trigger3.m_TriggerCheckRange > 0f) ? trigger3.m_TriggerCheckRange : this.m_Player.GetParams().GetTriggerCheckRange(); if (trigger3.CheckRange()) { vector2 = ((collider != null) ? collider.ClosestPointOnBounds(position) : trigger3.gameObject.transform.position); if (Vector3.Distance(position, vector2) > num6) { continue; } } vector2 = ((collider != null) ? collider.bounds.center : trigger3.gameObject.transform.position); vector = vector2 - crossHairOrigin; vector.Normalize(); if (trigger3.CheckDot()) { num4 = Vector3.Dot(this.m_CameraMain.transform.forward, vector); if (num4 < num || (trigger3.m_TriggerMaxDot > 0f && num4 < trigger3.m_TriggerMaxDot)) { continue; } } TriggerController.s_AllPotentialTriggers.Add(trigger3); if (!trigger3.OnlyInCrosshair()) { TriggerController.s_OffCrosshairTriggers.Add(trigger3); } TriggerController.s_ColldersEnabledMap[collider] = collider.enabled; collider.enabled = true; if (num6 > num5) { num5 = num6; } } } } Vector3 crossHairDir = this.GetCrossHairDir(); int num7 = (num5 > 0f) ? Physics.RaycastNonAlloc(crossHairOrigin, crossHairDir, TriggerController.s_RaycastHitCache, num5) : 0; if (num7 > 0) { TriggerController.s_CrosshairOrigin = crossHairOrigin; Array.Sort <RaycastHit>(TriggerController.s_RaycastHitCache, 0, num7, TriggerController.s_DistComparer); for (int i = 0; i < TriggerController.s_AllPotentialTriggers.Count; i++) { Trigger trigger4 = TriggerController.s_AllPotentialTriggers[i]; Collider collider2 = null; trigger4.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider2 = TriggerController.s_ColliderCache[0]; } if (collider2 != null) { for (int j = 0; j < num7; j++) { RaycastHit raycastHit = TriggerController.s_RaycastHitCache[j]; if (raycastHit.collider != null && !(raycastHit.collider.gameObject == base.gameObject) && !(raycastHit.collider == FistFightController.Get().m_RightHandCollider) && !(raycastHit.collider == FistFightController.Get().m_LeftHandCollider) && !(raycastHit.collider.gameObject == this.m_Proxy.m_Controller.gameObject)) { GhostSlot ghostSlot = null; raycastHit.collider.gameObject.GetComponents <GhostSlot>(TriggerController.s_GhostSlotCache); if (TriggerController.s_GhostSlotCache.Count > 0) { ghostSlot = TriggerController.s_GhostSlotCache[0]; } if (!flag || ghostSlot != null || trigger4.IsAdditionalTrigger()) { if (collider2 == raycastHit.collider || trigger4.IsAdditionalCollider(raycastHit.collider)) { if (trigger4.IsAdditionalTrigger()) { if (!trigger4.CheckDot() || num4 > num3 || (trigger4.m_TriggerMaxDot > 0f && num4 >= trigger4.m_TriggerMaxDot)) { hit_pos2 = raycastHit.point; trigger2 = trigger4; num3 = num4; break; } break; } else { if (trigger4.CheckDot() && num4 < num2 && (trigger4.m_TriggerMaxDot <= 0f || num4 < trigger4.m_TriggerMaxDot)) { break; } hit_pos = raycastHit.point; trigger = trigger4; if (!trigger || !trigger.IsLiquidSource()) { num2 = num4; break; } break; } } else { ITriggerThrough triggerThrough = null; raycastHit.collider.gameObject.GetComponents <ITriggerThrough>(TriggerController.s_TriggerThroughCache); if (TriggerController.s_TriggerThroughCache.Count > 0) { triggerThrough = TriggerController.s_TriggerThroughCache[0]; } if (triggerThrough == null && !raycastHit.collider.gameObject.GetComponent <TriggerThrough>() && (!trigger || !trigger.IsLiquidSource() || !(trigger.gameObject == raycastHit.collider.gameObject))) { if (ghostSlot != null) { flag = true; } else { Item currentItem2 = this.m_Player.GetCurrentItem(Hand.Right); if (currentItem2 == null || !(currentItem2.gameObject == raycastHit.collider.gameObject)) { currentItem2 = this.m_Player.GetCurrentItem(Hand.Left); if ((currentItem2 == null || !(currentItem2.gameObject == raycastHit.collider.gameObject)) && !(raycastHit.collider.gameObject == this.m_Proxy.m_Controller.gameObject)) { Trigger trigger5 = null; raycastHit.collider.gameObject.GetComponents <Trigger>(TriggerController.s_OtherTriggerCache); if (TriggerController.s_OtherTriggerCache.Count > 0) { trigger5 = TriggerController.s_OtherTriggerCache[0]; } if (trigger5 == null || !trigger5.TriggerThrough()) { break; } } } } } } } } } } } } if (trigger == null || trigger.IsLiquidSource()) { TriggerController.s_CrosshairDir = crossHairDir; TriggerController.s_CrosshairOrigin = crossHairOrigin; TriggerController.s_OffCrosshairTriggers.Sort(TriggerController.s_DotComparer); bool flag2 = false; int num8 = 0; while (num8 < TriggerController.s_OffCrosshairTriggers.Count && !flag2) { Trigger trigger6 = TriggerController.s_OffCrosshairTriggers[num8]; Collider collider3 = null; trigger6.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider3 = TriggerController.s_ColliderCache[0]; } if (collider3 != null) { float maxDistance = (trigger6.m_TriggerCheckRange > 0f) ? trigger6.m_TriggerCheckRange : this.m_Player.GetParams().GetTriggerCheckRange(); vector2 = ((collider3 != null) ? collider3.bounds.center : trigger6.gameObject.transform.position); vector = vector2 - crossHairOrigin; vector.Normalize(); num7 = Physics.RaycastNonAlloc(crossHairOrigin, vector, TriggerController.s_RaycastHitCache, maxDistance); if ((float)num7 > 0f) { TriggerController.s_CrosshairOrigin = crossHairOrigin; Array.Sort <RaycastHit>(TriggerController.s_RaycastHitCache, 0, num7, TriggerController.s_DistComparer); for (int k = 0; k < num7; k++) { RaycastHit raycastHit2 = TriggerController.s_RaycastHitCache[k]; if (!(raycastHit2.collider.gameObject == base.gameObject)) { GhostSlot ghostSlot2 = null; raycastHit2.collider.gameObject.GetComponents <GhostSlot>(TriggerController.s_GhostSlotCache); if (TriggerController.s_GhostSlotCache.Count > 0) { ghostSlot2 = TriggerController.s_GhostSlotCache[0]; } if (!flag || ghostSlot2 != null || trigger6.IsAdditionalTrigger()) { if (collider3 == raycastHit2.collider) { if (!trigger6.CheckDot() || num4 > num2 || (trigger6.m_TriggerMaxDot > 0f && num4 >= trigger6.m_TriggerMaxDot)) { hit_pos = raycastHit2.point; trigger = trigger6; num2 = num4; flag2 = true; break; } break; } else { ITriggerThrough triggerThrough2 = null; raycastHit2.collider.gameObject.GetComponents <ITriggerThrough>(TriggerController.s_TriggerThroughCache); if (TriggerController.s_TriggerThroughCache.Count > 0) { triggerThrough2 = TriggerController.s_TriggerThroughCache[0]; } if (triggerThrough2 == null && raycastHit2.collider.gameObject.layer != this.m_BalanceSpawnerLayer && (trigger == null || !trigger.IsLiquidSource() || !(trigger.gameObject == raycastHit2.collider.gameObject))) { if (ghostSlot2 != null) { flag = true; } else { Item currentItem3 = this.m_Player.GetCurrentItem(Hand.Right); if (currentItem3 == null || !(currentItem3.gameObject == raycastHit2.collider.gameObject)) { currentItem3 = this.m_Player.GetCurrentItem(Hand.Left); if (currentItem3 == null || !(currentItem3.gameObject == raycastHit2.collider.gameObject)) { Trigger trigger7 = null; raycastHit2.collider.gameObject.GetComponents <Trigger>(TriggerController.s_OtherTriggerCache); if (TriggerController.s_OtherTriggerCache.Count > 0) { trigger7 = TriggerController.s_OtherTriggerCache[0]; } if (trigger7 == null || !trigger7.TriggerThrough()) { if (trigger7 != null && TriggerController.s_OffCrosshairTriggers.Contains(trigger7)) { trigger = trigger7; hit_pos = raycastHit2.point; flag2 = true; break; } break; } } } } } } } } } } } num8++; } } Trigger trigger8 = null; if (trigger != this.m_BestTrigger.trigger && this.m_BestTrigger.trigger) { trigger8 = this.m_BestTrigger.trigger; } this.SetBestTrigger(trigger, hit_pos); if (trigger) { trigger.UpdateLayer(); } if (trigger8) { trigger8.UpdateLayer(); } if (this.m_AdditionalTrigger.trigger != trigger2) { if (trigger2 != this.m_AdditionalTrigger.trigger && this.m_AdditionalTrigger.trigger) { trigger8 = this.m_AdditionalTrigger.trigger; } this.m_AdditionalTrigger.trigger = trigger2; this.m_AdditionalTrigger.actions.Clear(); if (this.m_AdditionalTrigger.trigger) { this.m_AdditionalTrigger.trigger.GetActions(this.m_AdditionalTrigger.actions); } this.m_AdditionalTrigger.hit_pos = hit_pos2; if (this.m_AdditionalTrigger.trigger) { this.m_AdditionalTrigger.trigger.UpdateLayer(); } if (trigger8) { trigger8.UpdateLayer(); } } foreach (KeyValuePair <Collider, bool> keyValuePair in TriggerController.s_ColldersEnabledMap) { Collider key = keyValuePair.Key; Dictionary <Collider, bool> .Enumerator enumerator2; keyValuePair = enumerator2.Current; key.enabled = keyValuePair.Value; } return; } }
protected override bool ShouldShow() { return(!Player.Get().m_DreamActive&& !HUDReadableItem.Get().isActiveAndEnabled&& !CutscenesManager.Get().IsCutscenePlaying() && this.GetCurrentItem() != null); }
protected override bool ShouldShow() { return(!Player.Get().IsDead() && !Player.Get().m_DreamActive&& !CutscenesManager.Get().IsCutscenePlaying() && !SleepController.Get().IsActive() && !HUDWheel.Get().enabled&& !Storage3D.Get().IsActive() && !BodyInspectionController.Get().IsBandagingInProgress() && (Inventory3DManager.Get().gameObject.activeSelf || NotepadController.Get().IsActive() || MapController.Get().IsActive() || BodyInspectionController.Get().IsActive())); }
private bool CanShowMenuInGame() { return(!GreenHellGame.ROADSHOW_DEMO && !this.m_CurrentScreen && !Inventory3DManager.Get().gameObject.activeSelf&& !NotepadController.Get().enabled&& !MapController.Get().enabled&& !BodyInspectionController.Get().enabled&& !BodyInspectionMiniGameController.Get().enabled&& (!HUDEndDemo.Get() || !HUDEndDemo.Get().enabled) && !CutscenesManager.Get().IsCutscenePlaying() && !HUDStartSurvivalSplash.Get().m_Active); }
protected override bool ShouldShow() { return(GreenHellGame.Instance.m_GameMode == GameMode.Story && (!ChallengesManager.Get() || !ChallengesManager.Get().IsChallengeActive()) && !HUDReadableItem.Get().isActiveAndEnabled&& !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding") && (!ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive()) && !CutscenesManager.Get().IsCutscenePlaying()); }
public void Activate() { if (CutscenesManager.Get().IsCutscenePlaying()) { return; } if (base.gameObject.activeSelf) { return; } if (BodyInspectionMiniGameController.Get().IsActive()) { return; } if (VomitingController.Get().IsActive()) { return; } if (SwimController.Get().IsActive()) { return; } if (ConsciousnessController.Get().IsActive()) { return; } if (WatchController.Get().IsActive()) { return; } if (SleepController.Get().IsActive()) { return; } if (InsectsController.Get().IsActive()) { return; } if (HarvestingAnimalController.Get().IsActive()) { return; } if (HarvestingSmallAnimalController.Get().IsActive()) { return; } if (Player.Get().IsDead()) { return; } if (HitReactionController.Get().IsActive()) { return; } if (TriggerController.Get().IsGrabInProgress()) { return; } if (HUDMovie.Get().enabled&& HUDMovie.Get().gameObject.activeSelf) { return; } if (Player.Get().m_Aim || Time.time - Player.Get().m_StopAimTime < 0.5f) { return; } base.gameObject.SetActive(true); this.BlockPlayerRotation(true); if (!Player.Get().m_BodyInspectionController.IsActive() && !CraftingManager.Get().gameObject.activeSelf) { Player.Get().StartController(PlayerControllerType.Inventory); if (Player.Get().m_ControllerToStart != PlayerControllerType.Unknown) { Player.Get().StartControllerInternal(); } } this.m_Camera.enabled = true; this.m_Canvas.gameObject.SetActive(true); CursorManager.Get().ShowCursor(true); HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Inventory3D); this.m_CarriedItem = null; this.SetupPocket(this.m_ActivePocket); Player.Get().m_BackpackWasOpen = true; if (BodyInspectionController.Get().IsActive()) { HintsManager.Get().ShowHint("Inspection_Backpack", 10f); } this.m_ActivityChanged = true; }
protected override bool ShouldShow() { return(!Cheats.m_GodMode && !Player.Get().m_DreamActive&& !HUDReadableItem.Get().isActiveAndEnabled&& !CutscenesManager.Get().IsCutscenePlaying()); }
protected override bool ShouldShow() { return(!Player.Get().m_DreamActive&& !HUDReadableItem.Get().isActiveAndEnabled&& !CutscenesManager.Get().IsCutscenePlaying() && DifficultySettings.ActivePreset.m_Sanity); }
public bool CanShow() { if (GreenHellGame.Instance.m_GameMode != GameMode.Story) { return(false); } if (ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding")) { return(false); } if (ConsciousnessController.Get().IsActive()) { return(false); } if (SleepController.Get().IsActive()) { return(false); } if (InsectsController.Get().IsActive()) { return(false); } if (InsectsController.Get().IsActive()) { return(false); } if (SwimController.Get().IsActive()) { return(false); } if (Player.Get().m_IsInAir) { return(false); } if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive()) { return(false); } if (HUDReadableItem.Get().enabled) { return(false); } if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash)) { return(false); } if (Time.time - SwimController.Get().m_LastDisableTime < 0.5f) { return(false); } if (Player.Get().m_IsInAir) { return(false); } if (DeathController.Get().IsActive()) { return(false); } if (ScenarioManager.Get().IsDreamOrPreDream()) { return(false); } if (Inventory3DManager.Get().IsActive()) { return(false); } if (CutscenesManager.Get().IsCutscenePlaying()) { return(false); } if (SwimController.Get().IsActive()) { return(false); } if (BodyInspectionController.Get().IsActive()) { return(false); } if (HarvestingAnimalController.Get().IsActive()) { return(false); } if (HarvestingSmallAnimalController.Get().IsActive()) { return(false); } if (VomitingController.Get().IsActive()) { return(false); } if (MapController.Get().IsActive()) { return(false); } if (NotepadController.Get().IsActive()) { return(false); } if (MudMixerController.Get().IsActive()) { return(false); } if (MakeFireController.Get().IsActive()) { return(false); } if (HUDWheel.Get().enabled) { return(false); } if (FPPController.Get().m_Dodge) { return(false); } if (GreenHellGame.IsPadControllerActive() && HUDItem.Get().m_Active) { return(false); } int shortNameHash = Player.Get().m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash; return(shortNameHash != this.m_MapWatchHideHash && shortNameHash != this.m_MapWatchIdleHash && shortNameHash != this.m_MapWatchShowHash && shortNameHash != this.m_MapZoomHash && shortNameHash != this.m_MapHideHash && shortNameHash != this.m_MapIdleHash && shortNameHash != this.m_ShowMapHash); }
protected override bool ShouldShow() { return(this.m_Active && !ScenarioManager.Get().IsDreamOrPreDream() && !CutscenesManager.Get().IsCutscenePlaying()); }
private void UpdateBestTrigger() { if (HUDReadableItem.Get().enabled) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (Camera.main == null) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (CutscenesManager.Get().IsCutscenePlaying()) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (MakeFireController.Get().IsActive() && (MakeFireController.Get().ShouldBlockTriggers() || !Inventory3DManager.Get().gameObject.activeSelf)) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (CraftingController.Get().IsActive() && CraftingController.Get().m_InProgress) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (this.m_Player.m_ActiveFightController && this.m_Player.m_ActiveFightController.IsBlock()) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (HUDItem.Get().m_Active&& HUDItem.Get().m_Item) { this.SetBestTrigger(HUDItem.Get().m_Item, HUDItem.Get().m_Item.transform.position); return; } if (Inventory3DManager.Get().gameObject.activeSelf) { if (Inventory3DManager.Get().m_FocusedItem) { this.SetBestTrigger(Inventory3DManager.Get().m_FocusedItem, Inventory3DManager.Get().m_FocusedItem.transform.position); } else { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); } return; } if (BodyInspectionController.Get().IsActive()) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (Player.Get().m_Aim) { this.m_BestTrigger.Reset(); this.m_AdditionalTrigger.Reset(); return; } if (WeaponSpearController.Get().IsActive() && WeaponSpearController.Get().m_ItemBody) { this.SetBestTrigger(WeaponSpearController.Get().m_ItemBody, WeaponSpearController.Get().m_ItemBody.transform.position); return; } TriggerController.s_AllPotentialTriggers.Clear(); TriggerController.s_OffCrosshairTriggers.Clear(); TriggerController.s_ColldersEnabledMap.Clear(); Vector3 crossHairOrigin = this.GetCrossHairOrigin(); Vector3 position = Player.Get().transform.position; float num = 0.8f; float num2 = -1f; float num3 = -1f; float num4 = float.MinValue; Vector3 vector = Vector3.zero; Vector3 vector2 = Vector3.zero; TriggersManager triggersManager = TriggersManager.Get(); bool flag = false; Trigger trigger = null; Vector3 hit_pos = Vector3.zero; Trigger trigger2 = null; Vector3 hit_pos2 = Vector3.zero; float num5 = float.MinValue; for (int i = 0; i < triggersManager.GetActiveTriggersCount(); i++) { Trigger trigger3 = triggersManager.GetTrigger(i, false); if (trigger3 && trigger3.enabled) { if (!trigger3.m_IsCut) { if (trigger3.CanTrigger()) { Collider collider = null; trigger3.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider = TriggerController.s_ColliderCache[0]; } if (collider) { if (trigger3.CheckInsideCollider() && collider.bounds.Contains(Camera.main.transform.position) && trigger3.IsAdditionalTrigger() && (!trigger3.CheckDot() || num4 > num3)) { hit_pos2 = collider.bounds.center; trigger2 = trigger3; num3 = num4; } float num6 = (trigger3.m_TriggerCheckRange <= 0f) ? this.m_Player.GetParams().GetTriggerCheckRange() : trigger3.m_TriggerCheckRange; if (trigger3.CheckRange()) { vector2 = ((!collider) ? trigger3.gameObject.transform.position : collider.ClosestPointOnBounds(position)); float num7 = Vector3.Distance(position, vector2); if (num7 > num6) { goto IL_539; } } vector2 = ((!collider) ? trigger3.gameObject.transform.position : collider.bounds.center); vector = vector2 - crossHairOrigin; vector.Normalize(); if (trigger3.CheckDot()) { num4 = Vector3.Dot(Camera.main.transform.forward, vector); if (num4 < num) { goto IL_539; } } TriggerController.s_AllPotentialTriggers.Add(trigger3); if (!trigger3.OnlyInCrosshair()) { TriggerController.s_OffCrosshairTriggers.Add(trigger3); } TriggerController.s_ColldersEnabledMap[collider] = collider.enabled; collider.enabled = true; if (num6 > num5) { num5 = num6; } } } } } IL_539 :; } int num8 = Physics.RaycastNonAlloc(crossHairOrigin, this.GetCrossHairDir(), TriggerController.s_RaycastHitCache, num5); if ((float)num8 > 0f) { TriggerController.s_CrosshairOrigin = this.GetCrossHairOrigin(); Array.Sort <RaycastHit>(TriggerController.s_RaycastHitCache, 0, num8, TriggerController.s_DistComparer); for (int j = 0; j < TriggerController.s_AllPotentialTriggers.Count; j++) { Trigger trigger4 = TriggerController.s_AllPotentialTriggers[j]; Collider collider2 = null; trigger4.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider2 = TriggerController.s_ColliderCache[0]; } if (collider2) { for (int k = 0; k < num8; k++) { RaycastHit raycastHit = TriggerController.s_RaycastHitCache[k]; if (raycastHit.collider) { if (!(raycastHit.collider.gameObject == base.gameObject)) { if (!(raycastHit.collider == FistFightController.Get().m_RightHandCollider)) { if (!(raycastHit.collider == FistFightController.Get().m_LeftHandCollider)) { GhostSlot x = null; raycastHit.collider.gameObject.GetComponents <GhostSlot>(TriggerController.s_GhostSlotCache); if (TriggerController.s_GhostSlotCache.Count > 0) { x = TriggerController.s_GhostSlotCache[0]; } if (!flag || !(x == null) || trigger4.IsAdditionalTrigger()) { if (collider2 == raycastHit.collider || trigger4.IsAdditionalCollider(raycastHit.collider)) { if (trigger4.IsAdditionalTrigger()) { if (!trigger4.CheckDot() || num4 > num3) { hit_pos2 = raycastHit.point; trigger2 = trigger4; num3 = num4; } } else if (!trigger4.CheckDot() || num4 > num2) { hit_pos = raycastHit.point; trigger = trigger4; if (!trigger || !trigger.IsLiquidSource()) { num2 = num4; } } break; } ITriggerThrough triggerThrough = null; raycastHit.collider.gameObject.GetComponents <ITriggerThrough>(TriggerController.s_TriggerThroughCache); if (TriggerController.s_TriggerThroughCache.Count > 0) { triggerThrough = TriggerController.s_TriggerThroughCache[0]; } if (triggerThrough == null) { if (!trigger || !trigger.IsLiquidSource() || !(trigger.gameObject == raycastHit.collider.gameObject)) { if (x != null) { flag = true; } else { Item currentItem = this.m_Player.GetCurrentItem(Hand.Right); if (!currentItem || !(currentItem.gameObject == raycastHit.collider.gameObject)) { currentItem = this.m_Player.GetCurrentItem(Hand.Left); if (!currentItem || !(currentItem.gameObject == raycastHit.collider.gameObject)) { Trigger trigger5 = null; raycastHit.collider.gameObject.GetComponents <Trigger>(TriggerController.s_OtherTriggerCache); if (TriggerController.s_OtherTriggerCache.Count > 0) { trigger5 = TriggerController.s_OtherTriggerCache[0]; } if (!trigger5 || !trigger5.TriggerThrough()) { break; } } } } } } } } } } } } } } } if (trigger == null || trigger.IsLiquidSource()) { TriggerController.s_CrosshairDir = this.GetCrossHairDir(); TriggerController.s_CrosshairOrigin = this.GetCrossHairOrigin(); TriggerController.s_OffCrosshairTriggers.Sort(TriggerController.s_DotComparer); bool flag2 = false; int num9 = 0; while (num9 < TriggerController.s_OffCrosshairTriggers.Count && !flag2) { Trigger trigger6 = TriggerController.s_OffCrosshairTriggers[num9]; Collider collider3 = null; trigger6.gameObject.GetComponents <Collider>(TriggerController.s_ColliderCache); if (TriggerController.s_ColliderCache.Count > 0) { collider3 = TriggerController.s_ColliderCache[0]; } if (collider3) { float maxDistance = (trigger6.m_TriggerCheckRange <= 0f) ? this.m_Player.GetParams().GetTriggerCheckRange() : trigger6.m_TriggerCheckRange; vector2 = ((!collider3) ? trigger6.gameObject.transform.position : collider3.bounds.center); vector = vector2 - crossHairOrigin; vector.Normalize(); num8 = Physics.RaycastNonAlloc(crossHairOrigin, vector, TriggerController.s_RaycastHitCache, maxDistance); if ((float)num8 > 0f) { TriggerController.s_CrosshairOrigin = this.GetCrossHairOrigin(); Array.Sort <RaycastHit>(TriggerController.s_RaycastHitCache, 0, num8, TriggerController.s_DistComparer); for (int l = 0; l < num8; l++) { RaycastHit raycastHit2 = TriggerController.s_RaycastHitCache[l]; if (!(raycastHit2.collider.gameObject == base.gameObject)) { GhostSlot x2 = null; raycastHit2.collider.gameObject.GetComponents <GhostSlot>(TriggerController.s_GhostSlotCache); if (TriggerController.s_GhostSlotCache.Count > 0) { x2 = TriggerController.s_GhostSlotCache[0]; } if (!flag || !(x2 == null) || trigger6.IsAdditionalTrigger()) { if (collider3 == raycastHit2.collider) { if (!trigger6.CheckDot() || num4 > num2) { hit_pos = raycastHit2.point; trigger = trigger6; num2 = num4; flag2 = true; } break; } ITriggerThrough triggerThrough2 = null; raycastHit2.collider.gameObject.GetComponents <ITriggerThrough>(TriggerController.s_TriggerThroughCache); if (TriggerController.s_TriggerThroughCache.Count > 0) { triggerThrough2 = TriggerController.s_TriggerThroughCache[0]; } if (triggerThrough2 == null) { if (raycastHit2.collider.gameObject.layer != this.m_BalanceSpawnerLayer) { if (!trigger || !trigger.IsLiquidSource() || !(trigger.gameObject == raycastHit2.collider.gameObject)) { if (x2 != null) { flag = true; } else { Item currentItem2 = this.m_Player.GetCurrentItem(Hand.Right); if (!currentItem2 || !(currentItem2.gameObject == raycastHit2.collider.gameObject)) { currentItem2 = this.m_Player.GetCurrentItem(Hand.Left); if (!currentItem2 || !(currentItem2.gameObject == raycastHit2.collider.gameObject)) { Trigger trigger7 = null; raycastHit2.collider.gameObject.GetComponents <Trigger>(TriggerController.s_OtherTriggerCache); if (TriggerController.s_OtherTriggerCache.Count > 0) { trigger7 = TriggerController.s_OtherTriggerCache[0]; } if (!trigger7 || !trigger7.TriggerThrough()) { if (trigger7 && TriggerController.s_OffCrosshairTriggers.Contains(trigger7)) { trigger = trigger7; hit_pos = raycastHit2.point; flag2 = true; } break; } } } } } } } } } } } } num9++; } } this.SetBestTrigger(trigger, hit_pos); if (this.m_AdditionalTrigger.trigger != trigger2) { this.m_AdditionalTrigger.trigger = trigger2; this.m_AdditionalTrigger.actions.Clear(); if (this.m_AdditionalTrigger.trigger) { this.m_AdditionalTrigger.trigger.GetActions(this.m_AdditionalTrigger.actions); } this.m_AdditionalTrigger.hit_pos = hit_pos2; } foreach (KeyValuePair <Collider, bool> keyValuePair in TriggerController.s_ColldersEnabledMap) { Collider key = keyValuePair.Key; Collider collider4 = key; Dictionary <Collider, bool> .Enumerator enumerator; KeyValuePair <Collider, bool> keyValuePair2 = enumerator.Current; collider4.enabled = keyValuePair2.Value; } }