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; }
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); } }
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); } }
public MinimapDisplay(Transform parent) { for (int row = 0; row < tiles.GetLength(0); row++) { for (int col = 0; col < tiles.GetLength(1); col++) { var pos = new Vector2(row * 32, col * 16); var s = new Sprite(HUDSpriteFactory.Instance.CreateMinimapBlack()); MapTile t = new MapTile(s, pos); tiles[row, col] = t; Scene.Add(t); parent.AddChild(t); } } // link linkPosition = new HUDItem(HUDSpriteFactory.Instance.CreateMapGreenSquare(), new Vector2(0, 0)); SetLinkPosition(); Constants.SetLayerDepth(linkPosition, Constants.LayerDepth.Debug); Scene.Add(linkPosition); parent.AddChild(linkPosition); // boss bossRoom = new HUDItem(HUDSpriteFactory.Instance.CreateMapBossLocation(), new Vector2(0, 0)); var bossSprite = bossRoom.GetComponent <Sprite>(); bossSprite.SetVisible(false); bossSprite.SetAnimate(true); bossSprite.SetUpdateFrameSpeed(10); SetBossPosition(); Constants.SetLayerDepth(bossRoom, Constants.LayerDepth.Debug); Scene.Add(bossRoom); parent.AddChild(bossRoom); }
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 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); } }
private void AddHUDItem(HUDItem newItem) { TextBlock newFrameworkItem = null; switch (newItem.ItemType) { case HUDItemType.Text: newFrameworkItem = new TextBlock(); newFrameworkItem.Text = newItem.Label + newItem.Text; newFrameworkItem.FontSize = 64 * newItem.Size; newFrameworkItem.Name = newItem.Name; this.HUD.Children.Add(newFrameworkItem); break; case HUDItemType.Numeric: newFrameworkItem = new TextBlock(); newFrameworkItem.Text = newItem.Label + newItem.Value.ToString(); newFrameworkItem.FontSize = 64 * newItem.Size; newFrameworkItem.Name = newItem.Name; //Canvas.SetTop(newFrameworkItem, absY); this.HUDGrid.Children.Add(newFrameworkItem); break; case HUDItemType.Timer: break; } if (newFrameworkItem != null) { newFrameworkItem.HorizontalAlignment = newItem.HorizontalPosition; newFrameworkItem.VerticalAlignment = newItem.VerticalPosition; } }
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 void SetHUDItem(int id, Sprite keySprite, Sprite artefactSprite) { keyItem = new HUDItem() { ID = id, HUDSprite = keySprite, }; artefactItem = new HUDItem() { ID = id, HUDSprite = artefactSprite, }; }
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); } }
public void OnHover(Transform worldElement, Vector3 worldPoint, Camera gameCamera, Vector3 offset = default(Vector3)) { if (this.animationRoot != null) this.animationRoot.SetInState(); if (this.tempHud == null) this.tempHud = this.root.GetComponent<HUDItem>(); if (this.tempHud == null) this.tempHud = this.root.gameObject.AddComponent<HUDItem>(); this.tempHud.InitHUD(worldElement, this.workCamera, gameCamera, offset); this.tempHud.enabled = true; if (this.animationRoot != null) this.animationRoot.SetResetState(); }
// Add TNT for player public void AddTNT() { // If less than max TNT add new TNT while (TNTCount < 3) { TNTs[TNTCount] = new HUDItem() { ID = TNTCount, HUDSprite = TNTSprite }; hud.AddTNT(TNTs[TNTCount]); TNTCount++; } }
public override void OnDeinit(System.Action callback) { this.uiElement = null; this.uiElementCanvas = null; if (this.tempHud != null) { this.tempHud.Reset(); Component.Destroy(this.tempHud); } this.tempHud = null; base.OnDeinit(callback); }
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; }
// Enable player actions public void ActionsEnabled() { actionsEnabled = true; // Initialse the tnt for (int i = 0; i < TNTCount; i++) { TNTs[i] = new HUDItem() { ID = i, HUDSprite = TNTSprite }; hud.AddTNT(TNTs[i]); } }
// Token: 0x0600241E RID: 9246 RVA: 0x0041E0F8 File Offset: 0x0041C2F8 private void CloneValue(HUDItem Src, HUDItem Target) { Target.ThisTransform.gameObject.SetActive(Src.ThisTransform.gameObject.activeSelf); Target.Alpha.alpha = Src.Alpha.alpha; Target.DelayTime = Src.DelayTime; Target.FadeTime = Src.FadeTime; Target.Icon.sprite = Src.Icon.sprite; Target.Icon.material = Src.Icon.material; Target.CloneText(Src.MsgStr.ToString()); Target.MsgText.color = Src.MsgText.color; Target.ShowIconTime = Src.ShowIconTime; Target.bColseItem = Src.bColseItem; Target.MP3Sound = Src.MP3Sound; Target.SFXKind = Src.SFXKind; }
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(); } } }
///////////////////////End of Variables///////////////////////// ///////////////////////////Functions//////////////////////////// // Start is called before the first frame update void Start() { // Assign the references player = GameObject.FindGameObjectWithTag(Tags.playerTag); questManager = GameObject.FindGameObjectWithTag(Tags.gameControllerTag).GetComponent <QuestManager>(); hud = GameObject.FindGameObjectWithTag(Tags.uiTag).GetComponent <HUD>(); // Get the animator and sprite renderer SpriteRenderer renderer = transform.GetChild(0).GetComponent <SpriteRenderer>(); Animator anim = GetComponentInChildren <Animator>(); // Set civillian type switch (GameDataManager.instance.CivillianType()) { case CIVILLIANTYPE.MALE: civillianHUDItem = new HUDItem() { ID = 0, HUDSprite = maleCivillianIcon }; renderer.sprite = maleCivillian; anim.SetBool("Human", true); break; case CIVILLIANTYPE.FEMALE: civillianHUDItem = new HUDItem() { ID = 0, HUDSprite = femaleCivillianIcon }; renderer.sprite = femaleCivillian; anim.SetBool("Human", true); break; case CIVILLIANTYPE.CAT: civillianHUDItem = new HUDItem() { ID = 0, HUDSprite = catCivillianIcon }; renderer.sprite = catCivillian; anim.SetBool("Cat", true); break; } // Set the stats GameDataManager.instance.SetCivillianStats(transform.position, false, false); }
public void OnHover(Transform worldElement, Vector3 worldPoint, Camera gameCamera, Vector3 offset = default(Vector3)) { //if (this.animationRoot != null) this.animationRoot.SetInState(); if (this.tempHud == null) { this.tempHud = this.root.GetComponent <HUDItem>(); } if (this.tempHud == null) { this.tempHud = this.root.gameObject.AddComponent <HUDItem>(); } this.tempHud.InitHUD(worldElement, this.workCamera, gameCamera, offset); this.tempHud.enabled = true; //if (this.animationRoot != null) this.animationRoot.SetResetState(); }
//显示血条 void ShowHUDSlider() { List <RoleInstance> roles = BattleManager.Instance.GetModel().AliveRoles; childMgr.RefreshChildCount(roles.Count); List <Transform> childTrans = childMgr.GetUsingTransList(); for (int i = 0; i < childTrans.Count; i++) { HUDItem item = GameUtil.GetOrAddComponent <HUDItem>(childTrans[i]); RoleInstance role = roles[i]; if (role == null) { continue; } item.BindRole(role); } }
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; }
private void UpdateHUDItem(HUDItem updatedItem) { this.Dispatcher.Invoke((Action)(() => { foreach (TextBlock element in this.HUDGrid.Children.OfType <TextBlock>()) { if (element.Name == updatedItem.Name) { if (updatedItem.ItemType == HUDItemType.Text) { element.Text = updatedItem.Label + updatedItem.Text; } else { element.Text = updatedItem.Label + updatedItem.Value.ToString(); } } } })); }
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); }
public override bool Init() { try { _gameTimer = new Timer(); ControlType = ControlType.Absolute; rand = new Random(); _bonusSoundUri = new Uri("pack://application:,,,/" + AssemblyName + ";component/audio/bonus.wav"); _buzzerSoundUri = new Uri("pack://application:,,,/" + AssemblyName + ";component/audio/buzzer.wav"); AddRink(); AddPuck(); _scoreHUD = new HUDItem(); _scoreHUD.DefaultValue = 0; _scoreHUD.HorizontalPosition = HorizontalAlignment.Right; _scoreHUD.VerticalPosition = VerticalAlignment.Top; _scoreHUD.ItemType = HUDItemType.Numeric; _scoreHUD.Name = "Score"; _scoreHUD.Label = "Score:"; _countdownHUD = new HUDItem(); _countdownHUD.DefaultValue = 3; _countdownHUD.Value = 3; _countdownHUD.HorizontalPosition = HorizontalAlignment.Center; _countdownHUD.VerticalPosition = VerticalAlignment.Center; _countdownHUD.ItemType = HUDItemType.Numeric; _countdownHUD.Name = "Countdown"; _countdownHUD.Size = 4; _gameTimeHUD = new HUDItem(); _gameTimeHUD.HorizontalPosition = HorizontalAlignment.Center; _gameTimeHUD.VerticalPosition = VerticalAlignment.Top; _gameTimeHUD.DefaultValue = 30; _gameTimeHUD.Value = 30; _gameTimeHUD.Visible = false; _gameTimeHUD.ItemType = HUDItemType.Numeric; _gameTimeHUD.Name = "TimeRemaining"; _gameTimeHUD.Size = 2; HUDItems.Add(_gameTimeHUD); HUDItems.Add(_countdownHUD); HUDItems.Add(_scoreHUD); return(true); } catch (Exception) { if (_gameTimeHUD != null) { _gameTimeHUD.Dispose(); } if (_countdownHUD != null) { _countdownHUD.Dispose(); } if (_gameTimer != null) { _gameTimer.Dispose(); } if (_scoreHUD != null) { _scoreHUD.Dispose(); } throw; } }
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); } }
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(); }
void OnHUDCreate(Transform hudTrans) { HUDItem item = GameUtil.GetOrAddComponent <HUDItem>(hudTrans); item.Init(); }