public static void SetupObjects() { SaveGame.m_Objects.Clear(); SaveGame.m_Objects.Add(MainLevel.Instance); SaveGame.m_Objects.Add(Scenario.Get()); SaveGame.m_Objects.Add(AIManager.Get()); SaveGame.m_Objects.Add(TriggersManager.Get()); SaveGame.m_Objects.Add(ItemsManager.Get()); SaveGame.m_Objects.Add(SensorManager.Get()); SaveGame.m_Objects.Add(ConstructionGhostManager.Get()); SaveGame.m_Objects.Add(StaticObjectsManager.Get()); SaveGame.m_Objects.Add(Player.Get()); SaveGame.m_Objects.Add(PlayerConditionModule.Get()); SaveGame.m_Objects.Add(PlayerInjuryModule.Get()); SaveGame.m_Objects.Add(PlayerDiseasesModule.Get()); SaveGame.m_Objects.Add(StatsManager.Get()); SaveGame.m_Objects.Add(HintsManager.Get()); SaveGame.m_Objects.Add(ObjectivesManager.Get()); SaveGame.m_Objects.Add(HUDObjectives.Get()); SaveGame.m_Objects.Add(MenuNotepad.Get()); SaveGame.m_Objects.Add(MapTab.Get()); SaveGame.m_Objects.Add(Music.Get()); SaveGame.m_Objects.Add(RainManager.Get()); SaveGame.m_Objects.Add(BalanceSystem.Get()); }
/// <summary> /// Initialization /// </summary> public void Initialize() { if (isInitialized) { return; } prefabsPools = ScenarioManager.Instance.prefabsPools; var manager = ScenarioManager.Instance.GetExtension <ScenarioTriggersManager>(); defaultEffectorEditPanel = Instantiate(manager.defaultEffectorEditPanel, transform); defaultEffectorEditPanel.gameObject.SetActive(false); var customEffectorPanels = new Dictionary <Type, EffectorEditPanel>(); foreach (var customEffectorEditPanel in manager.customEffectorEditPanels) { customEffectorPanels.Add(customEffectorEditPanel.EditedEffectorType, customEffectorEditPanel); } var allEffectorTypes = TriggersManager.GetAllEffectorsTypes(); for (int i = 0; i < allEffectorTypes.Count; i++) { var effector = Activator.CreateInstance(allEffectorTypes[i]) as TriggerEffector; allEffectors.Add(effector); InitializeEffectorPanel(customEffectorPanels, effector); } isInitialized = true; }
public static WaypointTrigger DeserializeTrigger(JSONNode data) { if (data == null) { return(null); } var effectorsNode = data["effectors"].AsArray; var trigger = new WaypointTrigger(); for (var i = 0; i < effectorsNode.Count; i++) { var typeName = effectorsNode[i]["typeName"]; if (typeName == null) { typeName = effectorsNode[i]["type_name"]; } var newEffector = TriggersManager.GetEffectorOfType(typeName); if (newEffector == null) { Debug.LogWarning($"Could not find a trigger effector with type name: {typeName}."); continue; } newEffector.DeserializeProperties(effectorsNode[i]["parameters"]); trigger.AddEffector(newEffector); } return(trigger); }
public static void SetupObjects() { SaveGame.m_Objects.Clear(); SaveGame.m_Objects.Add(DifficultySettings.Get()); SaveGame.m_Objects.Add(DialogsManager.Get()); SaveGame.m_Objects.Add(AIManager.Get()); SaveGame.m_Objects.Add(EnemyAISpawnManager.Get()); SaveGame.m_Objects.Add(TriggersManager.Get()); SaveGame.m_Objects.Add(ItemsManager.Get()); SaveGame.m_Objects.Add(SensorManager.Get()); SaveGame.m_Objects.Add(ConstructionGhostManager.Get()); SaveGame.m_Objects.Add(StaticObjectsManager.Get()); SaveGame.m_Objects.Add(Player.Get()); SaveGame.m_Objects.Add(PlayerConditionModule.Get()); SaveGame.m_Objects.Add(PlayerInjuryModule.Get()); SaveGame.m_Objects.Add(PlayerDiseasesModule.Get()); SaveGame.m_Objects.Add(StatsManager.Get()); SaveGame.m_Objects.Add(HintsManager.Get()); SaveGame.m_Objects.Add(ObjectivesManager.Get()); SaveGame.m_Objects.Add(StoryObjectivesManager.Get()); SaveGame.m_Objects.Add(HUDObjectives.Get()); SaveGame.m_Objects.Add(MenuNotepad.Get()); SaveGame.m_Objects.Add(MapTab.Get()); SaveGame.m_Objects.Add(Music.Get()); SaveGame.m_Objects.Add(RainManager.Get()); SaveGame.m_Objects.Add(SleepController.Get()); SaveGame.m_Objects.Add(MainLevel.Instance); SaveGame.m_Objects.Add(ScenarioManager.Get()); SaveGame.m_Objects.Add(InventoryBackpack.Get()); SaveGame.m_Objects.Add(ReplicatedSessionState.Get()); }
private void PrepareLevel() { actorsManager = new AIActorsManager(); spawnPoints = FindObjectsOfType <SpawnPoint>(); triggersManager = new TriggersManager(FindObjectsOfType <Trigger>()); levelSettings = FindObjectOfType <LevelSettings>(); triggersManager.Init(); if (levelSettings != null) { GameController.instance.playerManager.TeleportToPoint(levelSettings.spawnPointId); levelSettings.Apply(GameController.instance); } }
private WaypointTrigger DeserializeTrigger(JSONNode data) { if (data == null) { return(null); } var effectorsNode = data["effectors"].AsArray; var trigger = new WaypointTrigger(); trigger.Effectors = new List <TriggerEffector>(); for (int i = 0; i < effectorsNode.Count; i++) { var typeName = effectorsNode[i]["type_name"]; var newEffector = TriggersManager.GetEffectorOfType(typeName); newEffector.DeserializeProperties(effectorsNode[i]["parameters"]); trigger.Effectors.Add(newEffector); } return(trigger); }
private void PrepareLevel() { if (currentLevel == null) { Debug.Log(" # -LvlCntr- # Current Level Not Found or not loaded"); return; } actorsController = new AIActorsController(); triggersManager = new TriggersManager(FindObjectsOfType <Trigger>()); spawnPoints = FindObjectsOfType <SpawnPoint>(); levelSettings = FindObjectOfType <LevelSettings>(); triggersManager.Init(); if (levelSettings != null) { PlayerManager.Instance().TeleportToPoint(levelSettings.spawnPointId); levelSettings.Apply(); } OnLevelLoaded?.Invoke(); }
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 TriggerEditViewModel(Bind bind) { triggersManager = new TriggersManager(bind); triggersManager.PropertyChanged += OnTriggersManagerPropertyChanged; }
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; } }