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); }
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; } }
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; }