protected override void Prepare() { base.Prepare(); base.StartAction(this.m_PunchBack); Direction direction; if (FistFightController.Get().IsActive()) { direction = (FistFightController.Get().IsLeftPunch() ? Direction.Right : Direction.Left); } else if (WeaponMeleeController.Get().IsActive()) { if (WeaponMeleeController.Get().IsRightAttack()) { direction = Direction.Left; } else if (WeaponMeleeController.Get().IsLeftAttack()) { direction = Direction.Right; } else { direction = ((UnityEngine.Random.Range(0f, 1f) < 0.5f) ? Direction.Right : Direction.Left); } } else { direction = ((UnityEngine.Random.Range(0f, 1f) < 0.5f) ? Direction.Right : Direction.Left); } this.m_PunchBack.SetDirection(direction); }
protected override void Prepare() { base.Prepare(); Vector3 normalized2D = (Player.Get().transform.position - this.m_HumanAI.transform.position).GetNormalized2D(); float num = Vector3.Angle(this.m_HumanAI.transform.forward.GetNormalized2D(), normalized2D); float num2 = 40f; float num3 = 0.3f; HitReaction.Type type = HitReaction.Type.Middle; if (num <= num2 && num3 <= UnityEngine.Random.Range(0f, 1f)) { type = HitReaction.Type.StepBack; } else if (FistFightController.Get().IsActive()) { type = ((!FistFightController.Get().IsLeftPunch()) ? HitReaction.Type.Right : HitReaction.Type.Left); } else if (WeaponMeleeController.Get().IsActive()) { if (WeaponMeleeController.Get().IsRightAttack()) { type = HitReaction.Type.Right; } else if (WeaponMeleeController.Get().IsLeftAttack()) { type = HitReaction.Type.Left; } else { type = HitReaction.Type.Middle; } } else if (num <= num2 && WeaponSpearController.Get().IsActive()) { type = HitReaction.Type.StepBack; } if (type == this.m_AI.m_HumanFightModule.m_LastHitReactionType && this.m_AI.m_GoalsModule.m_PrevGoal != null && this.m_AI.m_GoalsModule.m_PrevGoal.m_Type == AIGoalType.HumanHitReaction) { switch (type) { case HitReaction.Type.Right: case HitReaction.Type.Left: type = HitReaction.Type.Middle; break; case HitReaction.Type.Middle: type = HitReaction.Type.StepBack; break; case HitReaction.Type.StepBack: type = HitReaction.Type.Middle; break; } } this.m_HitReaction.SetType(type); this.m_AI.m_HumanFightModule.m_LastHitReactionType = type; this.m_HitReaction.Initialize(this.m_AI, this); base.AddToPlan(this.m_HitReaction); }
private void OnTriggerEnter(Collider other) { AI component = other.gameObject.GetComponent <AI>(); if (component == null || component.IsStringray()) { return; } FistFightController.Get().GiveDamage(component); }
protected override void OnEnable() { base.OnEnable(); FistFightController.Get().PlayerFightPunchAttackEnd(FistFightController.Mode.Cancelled); if (Player.Get().m_ActiveFightController) { Player.Get().m_ActiveFightController.ResetAttack(); } this.OnTakeDamage(); this.m_Animator.SetTrigger(this.m_EnterHash); this.m_LastHitTime = Time.time; }
public override void OnTakeDamage(DamageInfo info) { if (this.m_IsDead) { return; } GameObject damager = info.m_Damager; if (damager != null && damager.IsPlayer()) { this.ReplRequestOwnership(false); } base.OnTakeDamage(info); if (!AI.IsTurtle(this.m_AI.m_ID)) { this.DecreaseHealth(info.m_Damage); if (this.m_Health > 0f) { if (this.CanPunchBack()) { this.m_AI.m_GoalsModule.ActivateGoal(AIGoalType.PunchBack); } else if (this.m_AI.m_GoalsModule.m_ActiveGoal == null || this.m_AI.m_GoalsModule.m_ActiveGoal.m_Type != AIGoalType.Hide) { this.m_AI.m_GoalsModule.ActivateGoal(AIGoalType.ReactOnHit); } if (AI.IsSnake(this.m_AI.m_ID) && info.m_Damager.IsPlayer() && FistFightController.Get().IsActive()) { int num = UnityEngine.Random.Range(0, 2); AnimEventID event_id = AnimEventID.GiveDamageLLeg; if (num == 1) { event_id = AnimEventID.GiveDamageRLeg; } Vector3 world_hit_dir = this.m_AI.transform.TransformVector(DamageModule.GetHitDirLocal(event_id)); this.m_AI.m_DamageModule.GivePlayerDamage(world_hit_dir); this.m_AI.m_SnakeSoundModule.PlayAttackSound(); } } return; } if (this.m_AI.m_GoalsModule.m_ActiveGoal == null || this.m_AI.m_GoalsModule.m_ActiveGoal.m_Type != AIGoalType.Hide) { this.m_AI.m_GoalsModule.ActivateGoal(AIGoalType.Hide); return; } if (this.m_AI.m_GoalsModule.m_ActiveGoal.m_Type == AIGoalType.Hide) { this.m_AI.m_GoalsModule.m_ActiveGoal.ResetDuration(); } }
public override void OnTakeDamage(DamageInfo info) { if (this.m_IsDead) { return; } base.OnTakeDamage(info); this.DecreaseHealth(info.m_Damage); if (this.m_Health == 0f) { this.Die(); } else { if (this.CanPunchBack()) { this.m_AI.m_GoalsModule.ActivateGoal(AIGoalType.PunchBack); } else { this.m_AI.m_GoalsModule.ActivateGoal(AIGoalType.ReactOnHit); } if (AI.IsSnake(this.m_AI.m_ID) && info.m_Damager == Player.Get().gameObject&& FistFightController.Get().IsActive()) { this.m_AI.m_DamageModule.GivePlayerDamage(); this.m_AI.m_SnakeSoundModule.PlayAttackSound(); } } }
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 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; } }