public override void UpdateAfterCamera() { base.UpdateAfterCamera(); if (this.m_ActiveSlots.Count == 0 || !base.enabled) { return; } this.m_ClosestDistTemp = float.MaxValue; SlotData selectedSlotData = this.m_SelectedSlotData; this.m_SelectedSlotData = null; this.m_VisibleSlots.Clear(); foreach (SlotData slotData in this.m_ActiveSlots) { if (slotData.slot.IsBIWoundSlot()) { this.UpdateWoundSlots(slotData); } else { this.UpdateSlots(slotData); } } if (this.m_SelectedSlotData == null && Inventory3DManager.Get().IsActive() && Inventory3DManager.Get().m_ActivePocket != BackpackPocket.Left && Player.Get().GetCurrentItem(Hand.Right) && Player.Get().GetCurrentItem(Hand.Right).m_Info.IsFishingRod()) { FishingRod component = Player.Get().GetCurrentItem(Hand.Right).gameObject.GetComponent <FishingRod>(); ItemSlot y; if (!component.m_Hook) { y = component.m_HookSlot; } else { y = component.m_Hook.m_BaitSlot; } foreach (SlotData slotData2 in this.m_VisibleSlots) { if (slotData2.slot == y) { this.m_SelectedSlotData = slotData2; break; } } } if (this.m_SelectedSlotData != null) { this.m_SelectedSlotData.icon.rectTransform.localScale = Vector2.one * 2f; if (this.m_SelectedSlotData.add_icon) { this.m_SelectedSlotData.add_icon.rectTransform.localScale = Vector2.one * 0.5f; } Color color = this.m_SelectedSlotData.icon.color; color.a *= 1.5f; this.m_SelectedSlotData.icon.color = color; } if (this.m_SelectedSlotData != selectedSlotData) { HUDItem.Get().OnChangeSelectedSlot(this.m_SelectedSlotData); } }
private void OnRMouseDown() { if (HUDBackpack.Get().m_IsHovered) { return; } if (this.m_CarriedItem) { this.RotateItem(this.m_CarriedItem); } else if (this.m_FocusedItem) { if (!this.m_FocusedItem.m_OnCraftingTable) { HUDItem.Get().Activate(this.m_FocusedItem); } else { CraftingManager.Get().RemoveItem(this.m_FocusedItem); if (this.m_FocusedItem.m_Info.IsHeavyObject() || !this.m_FocusedItem.Take()) { this.DropItem(this.m_FocusedItem); } this.m_FocusedItem = null; } } else if (this.m_PlayerRotationBlocked) { this.BlockPlayerRotation(false); } }
private void StartPassingOut() { this.m_StartPassOutTime = 0f; this.m_Progress = 0f; this.m_PrevProgress = 0f; this.m_HoursDelta = 0f; this.m_HourProgress = 0; this.m_Player.ResetBlockMoves(); this.m_Player.ResetBlockRotation(); this.m_Player.BlockMoves(); this.m_Player.BlockRotation(); HUDItem.Get().Deactivate(); this.m_MovesBlocked = true; this.SetState(ConsciousnessController.ConsciousnessState.PassingOut); this.m_Animator.SetInteger(this.m_PassOutHash, 1); if (Inventory3DManager.Get().gameObject.activeSelf) { Inventory3DManager.Get().Deactivate(); } DialogsManager.Get().StopDialog(); Item currentItem = this.m_Player.GetCurrentItem(Hand.Right); if (currentItem && currentItem.m_Info.IsStone()) { this.m_Player.DropItem(currentItem); } }
private void UpdateCursor() { if (HUDItem.Get().enabled) { return; } if (HUDNewWheel.Get().IsSelected()) { return; } if (HUDBackpack.Get().m_IsHovered) { return; } if (this.m_CarriedItem) { if (CursorManager.Get().GetCursor() != CursorManager.TYPE.Hand_1) { CursorManager.Get().SetCursor(CursorManager.TYPE.Hand_1); } } else if (this.m_FocusedItem) { if (CursorManager.Get().GetCursor() != CursorManager.TYPE.Hand_0) { CursorManager.Get().SetCursor(CursorManager.TYPE.Hand_0); } } else if (CursorManager.Get().GetCursor() != CursorManager.TYPE.Normal) { CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); } }
public void Deactivate() { if (this.m_CarriedItem && !this.m_CarriedItem.m_CurrentSlot) { this.OnLMouseUp(); } this.BlockPlayerRotation(false); if (!Player.Get().m_BodyInspectionController.IsActive()) { Player.Get().StopController(PlayerControllerType.Inventory); } this.m_Camera.enabled = false; this.m_Canvas.gameObject.SetActive(false); CursorManager.Get().ShowCursor(false); CursorManager.Get().SetCursor(CursorManager.TYPE.Normal); HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Game); if (CraftingManager.Get().gameObject.activeSelf) { CraftingManager.Get().Deactivate(); } if (HUDItem.Get().m_Active) { HUDItem.Get().Deactivate(); } this.ResetNewCraftedItem(); this.m_SelectedSlot = null; this.m_SelectedGroup = null; this.m_MouseOverCraftTable = false; this.m_MouseOverBackpack = false; InventoryBackpack.Get().OnCloseBackpack(); base.gameObject.SetActive(false); this.m_DeactivationTime = Time.time; this.m_ActivityChanged = true; }
protected override void OnShow() { base.OnShow(); this.SetupDialogs(); this.SetupScroll(); Player.Get().BlockMoves(); Player.Get().BlockRotation(); if (GreenHellGame.IsPCControllerActive()) { CursorManager.Get().ShowCursor(CursorManager.TYPE.Normal); this.m_CursorVisible = true; } HUDItem.Get().Deactivate(); this.m_InGroup = false; this.m_MarkedData = null; Player.Get().m_ShouldStartWalkieTalkieController = true; if (Player.Get().GetCurrentItem(Hand.Left) == null) { Player.Get().StartController(PlayerControllerType.WalkieTalkie); } this.m_TempSanityTexts.Clear(); this.m_TempSanityTexts.AddRange(this.m_SanityTexts); this.m_BackButtonObject.SetActive(false); this.SetupScroll(); this.m_PadSelectionIndex = -1; }
public override void OnExecute(TriggerAction.TYPE action) { base.OnExecute(action); if (action == TriggerAction.TYPE.Take) { this.Take(); } else if (action == TriggerAction.TYPE.Expand) { HUDItem.Get().Activate(this); } }
protected override void OnEnable() { base.OnEnable(); this.m_Animator.SetInteger(this.m_NotepadHash, 1); this.m_Player.BlockRotation(); this.m_Player.BlockMoves(); HUDItem.Get().Deactivate(); if (Inventory3DManager.Get().gameObject.activeSelf) { Inventory3DManager.Get().Deactivate(); } this.m_CanDisable = false; }
protected override void OnShow() { base.OnShow(); Player.Get().BlockRotation(); if (GreenHellGame.IsPCControllerActive()) { CursorManager.Get().ShowCursor(true, false); this.m_CursorVisible = true; Vector3 position = base.gameObject.transform.position; CursorManager.Get().SetCursorPos(position); } for (int i = 0; i < 6; i++) { if (!this.IsSlotActive((HUDWheel.HUDWheelSlot)i)) { this.m_Icons[i].color = this.m_InactiveColor; } else { this.m_Icons[i].color = this.m_ActiveColor; } } if (Inventory3DManager.Get().IsActive()) { Inventory3DManager.Get().Deactivate(); } if (BodyInspectionController.Get().IsActive()) { BodyInspectionController.Get().Hide(); } if (NotepadController.Get().IsActive()) { NotepadController.Get().Hide(); } if (MapController.Get().IsActive()) { MapController.Get().Hide(); } HUDItem.Get().Deactivate(); this.m_SelectedSlot = HUDWheel.HUDWheelSlot.None; for (int j = 0; j < 6; j++) { this.m_Selections[j].enabled = false; this.m_Icons[j].enabled = true; this.m_IconsHL[j].enabled = false; } this.UpdateText(); }
public override void OnExecute(TriggerAction.TYPE action) { base.OnExecute(action); if (action == TriggerAction.TYPE.Fill) { this.TakeLiquid(); } else if (action == TriggerAction.TYPE.Expand) { HUDItem.Get().Activate(this); } else if (action == TriggerAction.TYPE.Drink || action == TriggerAction.TYPE.DrinkHold) { this.Drink(); } }
private void Update() { // Check if ACTION key is held for more than 0.5 seconds if (Input.GetKeyUp(GetActionKeyCode())) { interactionKeyHeldTime = 0f; heldInteractionKey = false; } else if (!heldInteractionKey && Input.GetKey(GetActionKeyCode())) { interactionKeyHeldTime += Time.deltaTime; if (interactionKeyHeldTime >= 0.25f) { heldInteractionKey = true; } } // If ACTION key is pressed while hovering a food in inventory, eat it Inventory3DManager inventory = Inventory3DManager.Get(); if (inventory && inventory.IsActive() && // Make sure inventory is currently open inventory.m_FocusedItem && !inventory.m_FocusedItem.m_OnCraftingTable && // Make sure the highlighted item isn't on crafting table !inventory.m_CarriedItem && // Make sure we aren't drag & dropping any items at the moment TriggerController.Get().GetBestTrigger() && TriggerController.Get().GetBestTrigger().gameObject == inventory.m_FocusedItem.gameObject && // Make sure the highlighted item is the item that the cursor is on !HUDItem.Get().m_Active&& // Make sure RMB menu isn't open for any item right now !InputsManager.Get().m_TextInputActive&& // Make sure chat isn't active (inventory.m_FocusedItem.m_Info.m_Eatable || inventory.m_FocusedItem.m_Info.m_Drinkable) && // Make sure the highlighted item is eatable or drinkable Input.GetKeyDown(GetActionKeyCode())) // Make sure hotkey is pressed { if (!inventory.m_FocusedItem.ReplIsOwner()) { inventory.m_FocusedItem.ReplRequestOwnership(); } inventory.m_FocusedItem.ReplSetDirty(); if (inventory.m_FocusedItem.m_Info.m_Eatable) { inventory.m_FocusedItem.Eat(); } else { inventory.m_FocusedItem.Drink(); } } }
public override void OnExecute(TriggerAction.TYPE action) { base.OnExecute(action); if (action == TriggerAction.TYPE.Expand) { HUDItem.Get().Activate(this); return; } Item item = this.ReplaceItem(); if (item) { item.OnExecute(action); if (!item.m_InInventory && !item.m_Info.IsHeavyObject()) { Inventory3DManager.Get().DropItem(item); } } }
private void Update() { if (!HUDItem.Get().m_Active&& // Make sure RMB menu isn't open for any item right now !InputsManager.Get().m_TextInputActive&& // Make sure chat isn't active GetButtonDown(hotkey) && // Make sure hotkey is pressed (SaveGame.m_State == SaveGame.State.Save || SaveGame.m_State == SaveGame.State.SaveCoop)) // Make sure save is actually stuck { List <Item> itemsToRemove = new List <Item>(4); foreach (Item item in Item.s_AllItems) { if (!item) { if (item.m_Info == null) { ModAPI.Log.Write("=== Encountered item with null info"); } else { ModAPI.Log.Write("=== Encountered item with info: " + item.m_Info.m_Type + " " + item.m_Info.m_ID + " " + item.m_Info.m_FakeItem); } itemsToRemove.Add(item); } } if (itemsToRemove.Count == 0) { ModAPI.Log.Write("=== There were no invalid items!"); } else { foreach (Item item in itemsToRemove) { Item.s_AllItems.Remove(item); } ModAPI.Log.Write("=== Remove invalid items: " + itemsToRemove.Count); } SaveGame.m_State = SaveGame.State.None; } }
protected override void OnEnable() { base.OnEnable(); this.CreateMapObject(); MenuNotepad.Get().gameObject.SetActive(true); this.m_Animator.SetBool(this.m_MapHash, true); this.PositionMap(); this.m_PrevNotepadTab = MenuNotepad.Get().m_ActiveTab; if (MenuNotepad.Get().m_ActiveTab != MenuNotepad.MenuNotepadTab.MapTab) { MenuNotepad.Get().SetActiveTab(MenuNotepad.MenuNotepadTab.MapTab, false); } if (Inventory3DManager.Get().gameObject.activeSelf) { Inventory3DManager.Get().Deactivate(); } this.m_Animator.SetBool(this.m_ZoomHash, false); HUDItem.Get().Deactivate(); this.m_CanDisable = false; }
protected override void OnEnable() { base.OnEnable(); this.m_FXCounter = 0; this.m_Player.BlockMoves(); this.m_State = VomitingController.State.Vomiting; this.m_BodyRotationBonesParams[base.gameObject.transform.FindDeepChild("mixamorig:Spine")] = 0f; this.m_BodyRotationBonesParams[base.gameObject.transform.FindDeepChild("mixamorig:Spine1")] = 0f; this.m_BodyRotationBonesParams[base.gameObject.transform.FindDeepChild("mixamorig:Spine2")] = 0f; this.m_Animator.SetBool(this.m_BVomiting, true); EventsManager.OnEvent(Enums.Event.Vomit, 1); TriggerController.Get().m_TriggerToExecute = null; TriggerController.Get().ResetTrigger(); if (HUDItem.Get().m_Active) { HUDItem.Get().Deactivate(); } this.m_Animator.SetBool(TriggerController.s_BGrabItem, false); this.m_Animator.SetBool(TriggerController.s_BGrabItemBow, false); this.m_Animator.SetBool(TriggerController.s_BGrabItemBambooBow, false); }
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; } }
private bool IsExpanded() { return(HUDItem.Get().enabled&& this.GetTrigger() && ((HUDItem.Get().m_Item&& HUDItem.Get().m_Item.gameObject == this.GetTrigger().gameObject) || (HUDItem.Get().m_LiquidSource&& HUDItem.Get().m_LiquidSource.gameObject == this.GetTrigger().gameObject) || (HUDItem.Get().m_PlantFruit&& HUDItem.Get().m_PlantFruit.gameObject == this.GetTrigger().gameObject) || (HUDItem.Get().m_ItemReplacer&& HUDItem.Get().m_ItemReplacer.gameObject == this.GetTrigger().gameObject))); }
private void Spoil() { if (GreenHellGame.ROADSHOW_DEMO) { return; } if (this.m_FInfo.m_SpoilEffectID == ItemID.None) { return; } Item item = ItemsManager.Get().CreateItem(this.m_FInfo.m_SpoilEffectID, !this.m_InInventory && !this.m_OnCraftingTable, base.transform.position, base.transform.rotation); if (this.m_InInventory) { InventoryBackpack.Get().RemoveItem(this, false); if (this.m_Info.m_InventoryCellsGroup != null) { this.m_Info.m_InventoryCellsGroup.Remove(this); } if (!this.m_CurrentSlot && this.m_InventorySlot && this.m_InventorySlot.m_Items.Count > 0) { this.m_InventorySlot.RemoveItem(this, false); } else if (this.m_CurrentSlot) { if (this.m_CurrentSlot.m_InventoryStackSlot) { this.m_CurrentSlot.RemoveItem(this, false); } else { this.m_CurrentSlot.RemoveItem(); } } InventoryBackpack.Get().InsertItem(item, this.m_CurrentSlot, this.m_Info.m_InventoryCellsGroup, true, true, true, true, true); if (this.m_InventorySlot) { this.m_InventorySlot.m_Blocked = true; if (item.m_InventorySlot) { for (int i = 0; i < this.m_InventorySlot.m_Items.Count; i++) { item.m_InventorySlot.InsertItem(this.m_InventorySlot.m_Items[i]); } } else { while (this.m_InventorySlot.m_Items.Count > 0) { Item item2 = this.m_InventorySlot.m_Items[0]; InventoryBackpack.Get().RemoveItem(item2, false); InventoryBackpack.Get().InsertItem(item2, null, null, true, true, true, true, true); } } } } else if (this.m_OnCraftingTable) { CraftingManager.Get().RemoveItem(this); CraftingManager.Get().AddItem(item, false); } if (HUDItem.Get().m_Item == this) { HUDItem.Get().Activate(item); } UnityEngine.Object.Destroy(base.gameObject); }
public override void OnInputAction(InputActionData action_data) { if ((action_data.m_Action == InputsManager.InputAction.Quit || action_data.m_Action == InputsManager.InputAction.AdditionalQuit) && (this.m_State == MakeFireController.State.WaitingForKindling || this.m_State == MakeFireController.State.Game) && (!GreenHellGame.IsPadControllerActive() || !HUDItem.Get().m_Active)) { this.SetState(MakeFireController.State.Quit); } }
private void Update() { // If the configurable hotkey is pressed, toggle highlights if (!HUDItem.Get().m_Active&& // Make sure RMB menu isn't open for any item right now !InputsManager.Get().m_TextInputActive) // Make sure chat isn't active { if (GetButtonDown(hotkey)) // If hotkey is pressed { isEnabled = !isEnabled; if (!isEnabled) { // Clear highlights Trigger[] _highlightedItems = new Trigger[HighlightedItems.Count]; HighlightedItems.CopyTo(_highlightedItems); HighlightedItems.Clear(); for (int i = 0; i < _highlightedItems.Length; i++) { if (_highlightedItems[i]) { _highlightedItems[i].m_ForcedLayer = 0; } } } } if (isEnabled && Input.GetKey(KeyCode.LeftControl)) { float scrollDelta = Input.mouseScrollDelta.y; if (scrollDelta != 0f) { radius = Mathf.Clamp(radius + scrollDelta, MIN_RADIUS, MAX_RADIUS); } } } if (isEnabled && Time.time >= nextUpdateTime) { nextUpdateTime = Time.time + UPDATE_INTERVAL; Vector3 playerPos = Player.Get().transform.position; float rangeSqr = radius * radius; // Find items within radius foreach (Trigger trigger in Trigger.s_ActiveTriggers) { if (!trigger) { continue; } Item item = trigger as Item; if (item) { // Don't highlight trees if (item.m_IsTree) { continue; } // Don't highlight useless plants if (item.m_IsPlant) { switch (item.m_Info.m_ID) { case Enums.ItemID.small_plant_08_cut: case Enums.ItemID.small_plant_10_cut: case Enums.ItemID.small_plant_13_cut: case Enums.ItemID.small_plant_14_cut: case Enums.ItemID.medium_plant_02_cut: case Enums.ItemID.medium_plant_04_cut: case Enums.ItemID.medium_plant_10_cut: break; default: continue; } } } // Don't highlight rivers because their highlight is glitchy if (trigger is LiquidSource) { continue; } bool isInRange = false; if (!item || !item.m_InPlayersHand) // Don't highlight items held by player { isInRange = trigger.transform.position.Distance2DSqr(playerPos) <= rangeSqr; } if (isInRange) { if (!HighlightedItems.Contains(trigger)) { HighlightedItems.Add(trigger); } if (trigger.m_ForcedLayer != trigger.m_OutlineLayer) { trigger.m_ForcedLayer = trigger.m_OutlineLayer; } } else if (HighlightedItems.Contains(trigger)) { HighlightedItems.Remove(trigger); trigger.m_ForcedLayer = 0; } } // Remove destroyed items from HashSet HighlightedItems.RemoveWhere((trigger) => !trigger); } }
private void Update() { // If the configurable hotkey is pressed while hovering an item in inventory, move the item to crafting table Inventory3DManager inventory = Inventory3DManager.Get(); CraftingManager craftingTable = CraftingManager.Get(); if (inventory && craftingTable && !HUDItem.Get().m_Active&& // Make sure RMB menu isn't open for any item right now TriggerController.Get().GetBestTrigger() && // Make sure there is a highlighted item !InputsManager.Get().m_TextInputActive&& // Make sure chat isn't active GetButtonDown(hotkey)) // Make sure hotkey is pressed { bool forceOpenedInventory = false; if (!inventory.IsActive() && openInventoryIfNotOpen) { // Force open inventory Item triggerItem = TriggerController.Get().GetBestTrigger().GetComponent <Item>(); if (triggerItem) { inventory.Activate(); if (inventory.IsActive()) { forceOpenedInventory = true; inventory.m_FocusedItem = triggerItem; if (!triggerItem.GetWasTriggered()) { triggerItem.SetWasTriggered(true); } } } } if (inventory.IsActive() && // Make sure inventory is currently open inventory.m_FocusedItem && !inventory.m_FocusedItem.m_OnCraftingTable && // Make sure the highlighted item isn't already on crafting table !inventory.m_CarriedItem && inventory.CanSetCarriedItem(true) && // Make sure we aren't drag & dropping any items at the moment TriggerController.Get().GetBestTrigger().gameObject == inventory.m_FocusedItem.gameObject) // Make sure the highlighted item is the item that the cursor is on { craftingTable.Activate(); inventory.StartCarryItem(inventory.m_FocusedItem, false); craftingTable.AddItem(inventory.m_CarriedItem, true); if (inventory.m_StackItems != null) { for (int i = 0; i < inventory.m_StackItems.Count; i++) { craftingTable.AddItem(inventory.m_StackItems[i], true); } } inventory.SetCarriedItem(null, true); if (dropItemToTableClip) { inventory.GetComponent <AudioSource>().PlayOneShot(dropItemToTableClip); } } else if (forceOpenedInventory) { inventory.Deactivate(); } } }
public void OnInputAction(InputActionData action_data) { if (Inventory3DManager.Get().m_CarriedItem == null) { if (action_data.m_Action == InputsManager.InputAction.InventoryNextTab) { if (HUDItem.Get().m_Active) { HUDItem.Get().Deactivate(); } BackpackPocket pocket = Inventory3DManager.Get().m_ActivePocket; switch (pocket) { case BackpackPocket.Main: pocket = BackpackPocket.Front; break; case BackpackPocket.Front: pocket = BackpackPocket.Right; break; case BackpackPocket.Top: pocket = BackpackPocket.Main; break; case BackpackPocket.Left: pocket = BackpackPocket.Top; break; case BackpackPocket.Right: pocket = BackpackPocket.Left; break; } Inventory3DManager.Get().SetupPocket(pocket); return; } if (action_data.m_Action == InputsManager.InputAction.InventoryPrevTab) { if (HUDItem.Get().m_Active) { HUDItem.Get().Deactivate(); } BackpackPocket pocket2 = Inventory3DManager.Get().m_ActivePocket; switch (pocket2) { case BackpackPocket.Main: pocket2 = BackpackPocket.Top; break; case BackpackPocket.Front: pocket2 = BackpackPocket.Main; break; case BackpackPocket.Top: pocket2 = BackpackPocket.Left; break; case BackpackPocket.Left: pocket2 = BackpackPocket.Right; break; case BackpackPocket.Right: pocket2 = BackpackPocket.Front; break; } Inventory3DManager.Get().SetupPocket(pocket2); } } }
private bool CanCrouch() { return(!Inventory3DManager.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !HeavyObjectController.Get().IsActive() && !WalkieTalkieController.Get().IsActive() && !ConstructionController.Get().IsActive() && !HUDItem.Get().m_Active&& !HUDWheel.Get().m_Active); }
private void OnLMouseDown() { if (!this.m_FocusedItem || HUDBackpack.Get().m_IsHovered || this.m_FocusedItem.m_Info.m_CantBeDraggedInInventory || HUDItem.Get().enabled) { return; } this.SetCarriedItem(this.m_FocusedItem); if (CraftingManager.Get().gameObject.activeSelf&& CraftingManager.Get().ContainsItem(this.m_FocusedItem)) { CraftingManager.Get().RemoveItem(this.m_FocusedItem); } if (this.m_FocusedItem == Player.Get().GetCurrentItem(Hand.Right)) { Player.Get().SetWantedItem(Hand.Right, null, true); } else if (this.m_FocusedItem == Player.Get().GetCurrentItem(Hand.Left)) { Player.Get().SetWantedItem(Hand.Left, null, true); } }
protected override void Update() { base.Update(); this.m_BackpackHint.SetActive(GreenHellGame.IsPadControllerActive() && !Inventory3DManager.Get().IsActive()); this.m_SortBackpackHint.SetActive(GreenHellGame.IsPadControllerActive() && Inventory3DManager.Get().IsActive()); Limb limb = Limb.None; if (GreenHellGame.IsPCControllerActive()) { for (int i = 0; i < 4; i++) { if (this.m_SelectionColliders[i].OverlapPoint(Input.mousePosition)) { limb = (Limb)i; break; } } } else if (!HUDItem.Get().enabled) { float axis = CrossPlatformInputManager.GetAxis("LeftStickX"); float axis2 = CrossPlatformInputManager.GetAxis("LeftStickY"); Vector2 zero = Vector2.zero; zero.x = axis; zero.y = axis2; if (zero.magnitude > 0.08f) { float num = Vector3.Angle(zero, Vector3.up); if (axis > 0f) { num = 360f - num; } if (num <= 90f) { limb = Limb.RArm; } else if (num > 90f && num <= 180f) { limb = Limb.RLeg; } else if (num > 180f && num <= 270f) { limb = Limb.LLeg; } else if (num > 270f) { limb = Limb.LArm; } } } this.SelectLimb(limb); if ((GreenHellGame.IsPCControllerActive() && Input.GetMouseButtonDown(0)) || (GreenHellGame.IsPadControllerActive() && Input.GetKeyDown(InputHelpers.PadButton.L3.KeyFromPad()))) { this.OnClickLimb(limb); switch (limb) { case Limb.LArm: BodyInspectionController.Get().m_Inputs.m_ChooseLimbX = -1f; BodyInspectionController.Get().m_Inputs.m_ChooseLimbY = 1f; break; case Limb.RArm: BodyInspectionController.Get().m_Inputs.m_ChooseLimbX = 1f; BodyInspectionController.Get().m_Inputs.m_ChooseLimbY = 1f; break; case Limb.LLeg: BodyInspectionController.Get().m_Inputs.m_ChooseLimbX = -1f; BodyInspectionController.Get().m_Inputs.m_ChooseLimbY = -1f; break; case Limb.RLeg: BodyInspectionController.Get().m_Inputs.m_ChooseLimbX = 1f; BodyInspectionController.Get().m_Inputs.m_ChooseLimbY = -1f; break; } } this.UpdateArmor(); this.UpdateSmallIcons(); this.UpdateArmorTooltip(); }
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().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; } }
private void Spoil() { if (GreenHellGame.ROADSHOW_DEMO) { return; } if (this.m_FInfo.m_SpoilEffectID == ItemID.None) { return; } bool inventoryRotated = this.m_Info.m_InventoryRotated; Quaternion rotation = base.transform.rotation; Vector3 position = base.transform.position; Item item = ItemsManager.Get().CreateItem(this.m_FInfo.m_SpoilEffectID, !base.m_InInventory && !base.m_InStorage && !base.m_OnCraftingTable, base.transform.position, base.transform.rotation); if (Inventory3DManager.Get().m_CarriedItem == this) { foreach (Item item2 in Inventory3DManager.Get().m_StackItems) { Quaternion localRotation = item2.transform.localRotation; Vector3 localPosition = item2.transform.localPosition; item2.transform.parent = item.transform; item2.transform.localRotation = localRotation; item2.transform.localPosition = localPosition; } Inventory3DManager.Get().SetCarriedItem(null, false); Inventory3DManager.Get().SetCarriedItem(item, false); ItemsManager.Get().ActivateItem(item); } else if (Inventory3DManager.Get().m_StackItems.Contains(this)) { Inventory3DManager.Get().m_StackItems.Remove(this); this.UpdateLayer(); item.transform.parent = item.transform; item.transform.localRotation = base.transform.localRotation; item.transform.localPosition = base.transform.localPosition; Inventory3DManager.Get().m_StackItems.Add(item); item.UpdateLayer(); ItemsManager.Get().ActivateItem(item); } else if (base.m_CurrentSlot && base.m_CurrentSlot.m_InventoryStackSlot) { ItemSlot currentSlot = base.m_CurrentSlot; InventoryBackpack.Get().m_Items.Remove(this); if (this.m_Info.m_InventoryCellsGroup != null) { this.m_Info.m_InventoryCellsGroup.Remove(this); } ((ItemSlotStack)currentSlot).ReplaceItem(this, item); item.gameObject.isStatic = false; if (base.m_InInventory) { InventoryBackpack.Get().m_Items.Add(item); item.OnAddToInventory(); item.gameObject.SetActive(base.gameObject.activeSelf); InventoryBackpack.Get().OnInventoryChanged(); } else { this.m_Storage.m_Items.Add(item); item.OnAddToStorage(this.m_Storage); item.gameObject.SetActive(base.gameObject.activeSelf); } } else { if (base.m_InInventory) { ItemSlot currentSlot2 = base.m_CurrentSlot; InventoryCellsGroup inventoryCellsGroup = this.m_Info.m_InventoryCellsGroup; List <Item> list = this.m_InventorySlot ? new List <Item>(this.m_InventorySlot.m_Items) : new List <Item>(); InventoryBackpack.Get().RemoveItem(this, false); if (!base.m_CurrentSlot && this.m_InventorySlot && list.Count > 0) { using (List <Item> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { Item item3 = enumerator.Current; if (item3.m_Info.m_InventoryCellsGroup != null) { item3.m_Info.m_InventoryCellsGroup.Remove(item3); } } goto IL_3A3; } } if (base.m_CurrentSlot) { if (base.m_CurrentSlot.m_InventoryStackSlot) { base.m_CurrentSlot.RemoveItem(this, false); } else { base.m_CurrentSlot.RemoveItem(); } } IL_3A3: InventoryBackpack.Get().InsertItem(item, currentSlot2, inventoryCellsGroup, true, true, true, true, true); if (!item.m_InventorySlot || list.Count <= 0) { goto IL_5BD; } using (List <Item> .Enumerator enumerator = list.GetEnumerator()) { while (enumerator.MoveNext()) { Item item4 = enumerator.Current; item.m_InventorySlot.InsertItem(item4); } goto IL_5BD; } } if (base.m_OnCraftingTable) { CraftingManager.Get().RemoveItem(this, false); CraftingManager.Get().AddItem(item, false); } else if (base.m_CurrentSlot) { ItemSlot currentSlot3 = base.m_CurrentSlot; currentSlot3.RemoveItem(); currentSlot3.InsertItem(item); } else if (base.m_InStorage && this.m_Storage) { Storage storage = this.m_Storage; ItemSlot currentSlot4 = base.m_CurrentSlot; InventoryCellsGroup inventoryCellsGroup2 = this.m_Info.m_InventoryCellsGroup; List <Item> list2 = this.m_InventorySlot ? new List <Item>(this.m_InventorySlot.m_Items) : new List <Item>(); storage.RemoveItem(this, false); if (!base.m_CurrentSlot && this.m_InventorySlot && list2.Count > 0) { using (List <Item> .Enumerator enumerator = list2.GetEnumerator()) { while (enumerator.MoveNext()) { Item item5 = enumerator.Current; item5.m_Info.m_InventoryCellsGroup.Remove(item5); } goto IL_559; } } if (base.m_CurrentSlot) { if (base.m_CurrentSlot.m_InventoryStackSlot) { base.m_CurrentSlot.RemoveItem(this, false); } else { base.m_CurrentSlot.RemoveItem(); } } IL_559: storage.InsertItem(item, base.m_CurrentSlot, inventoryCellsGroup2, true, true); if (item.m_InventorySlot && list2.Count > 0) { foreach (Item item6 in list2) { item.m_InventorySlot.InsertItem(item6); } } } } IL_5BD: if (inventoryRotated) { Inventory3DManager.Get().RotateItem(item, true); } if (HUDItem.Get().m_Item == this) { HUDItem.Get().Activate(item); } UnityEngine.Object.Destroy(base.gameObject); item.transform.rotation = rotation; item.transform.position = position; }