public void AddWorm(string place) { InjuryPlace place2 = (InjuryPlace)Enum.Parse(typeof(InjuryPlace), place); BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place2, InjuryType.Worm, true); this.AddInjury(InjuryType.Worm, place2, freeWoundSlot, InjuryState.Open, 0, null, null); }
public void ScenarioAddInjury(string type, string place, string state) { InjuryType injuryType = (InjuryType)Enum.Parse(typeof(InjuryType), type); InjuryPlace place2 = (InjuryPlace)Enum.Parse(typeof(InjuryPlace), place); InjuryState state2 = (InjuryState)Enum.Parse(typeof(InjuryState), state); BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place2, injuryType, true); Injury injury = null; if (freeWoundSlot != null) { injury = this.AddInjury(injuryType, place2, freeWoundSlot, state2, 0, null, null); } if (injury != null) { switch (state2) { case InjuryState.Open: injury.OpenWound(); return; case InjuryState.Infected: injury.Infect(); return; case InjuryState.Closed: injury.CloseWound(); break; default: return; } } }
public void Load() { this.ResetInjuries(); int num = SaveGame.LoadIVal("InjuriesCount"); for (int i = 0; i < num; i++) { InjuryType injuryType = (InjuryType)SaveGame.LoadIVal("InjuryType" + i); InjuryPlace place = (InjuryPlace)SaveGame.LoadIVal("InjuryPlace" + i); InjuryState injuryState = (InjuryState)SaveGame.LoadIVal("InjuryState" + i); if (injuryType != InjuryType.WormHole || injuryState != InjuryState.WormInside) { BIWoundSlot woundSlot = BodyInspectionController.Get().GetWoundSlot(place, SaveGame.LoadSVal("InjurySlot" + i)); int poison_level = SaveGame.LoadIVal("InjuryPoisonLevel" + i); Injury injury = this.AddInjury(injuryType, place, woundSlot, injuryState, poison_level, null, null); if (injury != null) { if (injuryState == InjuryState.Infected) { injury.Infect(); } else if (injuryState == InjuryState.Closed) { injury.CloseWound(); } injury.Load(i); } } } }
public Injury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null) { this.m_Type = type; this.m_Place = place; slot.SetInjury(this); this.m_Slot = slot; this.m_StartTimeInMinutes = MainLevel.Instance.GetCurrentTimeMinutes(); this.m_PoisonLevel = poison_level; this.m_TimeToInfect = this.m_DefaultTimeToInfect; this.m_ParentInjury = parent_injury; if (type == InjuryType.VenomBite || type == InjuryType.SnakeBite) { Player.Get().GetComponent <PlayerDiseasesModule>().RequestDisease(ConsumeEffect.Fever, 0f, 1); } this.m_State = state; this.UpdateHealthDecreasePerSec(); this.SetWoundMaterial(this.m_Slot.m_Wound); if (slot.m_AdditionalMeshes != null) { for (int i = 0; i < slot.m_AdditionalMeshes.Count; i++) { this.SetWoundMaterial(slot.m_AdditionalMeshes[i]); } } this.SetAdditionalInjury(this); Injury.s_NumInjuries++; }
public void ScenarioAddInjury(string type, string place, string state) { InjuryType injuryType = (InjuryType)Enum.Parse(typeof(InjuryType), type); InjuryPlace place2 = (InjuryPlace)Enum.Parse(typeof(InjuryPlace), place); InjuryState injuryState = (InjuryState)Enum.Parse(typeof(InjuryState), state); BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place2, injuryType); Injury injury = null; if (freeWoundSlot != null) { injury = this.AddInjury(injuryType, place2, freeWoundSlot, injuryState, 0, null); } if (injuryState != InjuryState.Open) { if (injuryState != InjuryState.Infected) { if (injuryState == InjuryState.Closed) { injury.CloseWound(); } } else { injury.Infect(); } } else { injury.OpenWound(); } }
public Injury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null, DamageInfo damage_info = null) { this.m_Type = type; this.m_Place = place; slot.SetInjury(this); this.m_Slot = slot; this.m_StartTimeInMinutes = MainLevel.Instance.GetCurrentTimeMinutes(); this.m_PoisonLevel = poison_level; this.m_TimeToInfect = this.m_DefaultTimeToInfect; this.m_ParentInjury = parent_injury; if (damage_info != null && damage_info.m_Damager != null) { AI component = damage_info.m_Damager.GetComponent <AI>(); if (component != null) { this.m_AIDamager = component.m_ID; } } this.m_State = state; this.UpdateHealthDecreasePerSec(); this.SetWoundMaterial(this.m_Slot.m_Wound); if (slot.m_AdditionalMeshes != null) { for (int i = 0; i < slot.m_AdditionalMeshes.Count; i++) { this.SetWoundMaterial(slot.m_AdditionalMeshes[i]); } } this.SetAdditionalInjury(this); Injury.s_NumInjuries++; }
private void UpdateWoundSlots(HUDItemSlot.SlotData data) { bool flag = Inventory3DManager.Get().isActiveAndEnabled&& BodyInspectionController.Get().IsActive() && (!Inventory3DManager.Get().m_CarriedItem || data.slot.CanInsertItem(Inventory3DManager.Get().m_CarriedItem)); data.obj.gameObject.SetActive(flag); if (!flag) { return; } Vector3 screenPoint = data.slot.GetScreenPoint(); if (screenPoint.z <= 0f) { data.icon.enabled = false; return; } data.icon.rectTransform.position = screenPoint; BIWoundSlot biwoundSlot = (BIWoundSlot)data.slot; if (biwoundSlot.GetInjury() != null && BodyInspectionController.Get() != null && BodyInspectionController.Get().enabled&& biwoundSlot.GetInjury().m_Bandage == null && biwoundSlot.m_Maggots == null && biwoundSlot.GetInjury().m_ParentInjury == null) { data.icon.enabled = true; data.icon.color = ((!(Inventory3DManager.Get().m_SelectedSlot == data.slot)) ? this.m_NormalColor : this.m_SelectedColor); } else { data.icon.enabled = false; } }
private void TryAddWorm() { for (int i = 0; i < 4; i++) { BIWoundSlot freeWoundSlot = BodyInspectionController.Get().GetFreeWoundSlot((InjuryPlace)i, InjuryType.Worm, true); if (freeWoundSlot != null) { PlayerInjuryModule.Get().AddInjury(InjuryType.Worm, (InjuryPlace)i, freeWoundSlot, InjuryState.Open, 0, null, null); return; } } }
public Injury AddInjury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null) { if (!slot || PlayerConditionModule.Get().GetParameterLossBlocked()) { return(null); } if (type == InjuryType.Leech && this.GetAllInjuries(type).Count == 0 && PlayerSanityModule.Get()) { PlayerSanityModule.Get().ResetEventCooldown(PlayerSanityModule.SanityEventType.Leech); } Debug.Log("AddInjury"); Injury injury = new Injury(type, place, slot, state, poison_level, parent_injury); this.m_Injuries.Add(injury); this.OnAddInjury(type); return(injury); }
public void OnCreateWound() { PlayerInjuryModule playerInjuryModule = PlayerInjuryModule.Get(); InjuryType injuryType = (InjuryType)Enum.GetValues(typeof(InjuryType)).GetValue(this.m_WoundTypeList.GetSelectionIndex()); BIWoundSlot biwoundSlot = null; if (this.m_ToggleLH.isOn) { biwoundSlot = BodyInspectionController.Get().GetFreeWoundSlot(InjuryPlace.LHand, injuryType); } else if (this.m_ToggleRH.isOn) { biwoundSlot = BodyInspectionController.Get().GetFreeWoundSlot(InjuryPlace.RHand, injuryType); } else if (this.m_ToggleLL.isOn) { biwoundSlot = BodyInspectionController.Get().GetFreeWoundSlot(InjuryPlace.LLeg, injuryType); } else if (this.m_ToggleRL.isOn) { biwoundSlot = BodyInspectionController.Get().GetFreeWoundSlot(InjuryPlace.RLeg, injuryType); } if (biwoundSlot != null) { int poison_level = 0; if (injuryType == InjuryType.VenomBite || injuryType == InjuryType.SnakeBite) { string text = this.m_PosionLevel.text; if (!int.TryParse(text, out poison_level)) { poison_level = 1; } } InjuryState state = InjuryState.Open; if (injuryType == InjuryType.Laceration || injuryType == InjuryType.Laceration) { state = InjuryState.Bleeding; } else if (injuryType == InjuryType.WormHole) { state = InjuryState.WormInside; } playerInjuryModule.AddInjury(injuryType, biwoundSlot.m_InjuryPlace, biwoundSlot, state, poison_level, null); } }
private void SpawnInsects(int count, Hand hand) { GameObject original = this.m_Prefabs[this.m_Type]; for (int i = 0; i < count; i++) { BIWoundSlot woundSlot = BodyInspectionController.Get().GetWoundSlot((hand != Hand.Right) ? InjuryPlace.LHand : InjuryPlace.RHand, InjuryType.Leech, null); if (!woundSlot) { break; } InsectData insectData = new InsectData(); insectData.m_Insect = UnityEngine.Object.Instantiate <GameObject>(original, woundSlot.transform.position, woundSlot.transform.rotation); insectData.m_Slot = woundSlot; insectData.m_Hand = hand; this.m_Insects.Add(insectData); } }
private void UpdateWoundSlots(SlotData data) { if (!Inventory3DManager.Get().isActiveAndEnabled || !BodyInspectionController.Get().IsActive()) { data.obj.gameObject.SetActive(false); return; } if (GreenHellGame.IsPCControllerActive() && (Inventory3DManager.Get().m_CarriedItem == null || !data.slot.CanInsertItem(Inventory3DManager.Get().m_CarriedItem))) { data.obj.gameObject.SetActive(false); return; } BIWoundSlot biwoundSlot = (BIWoundSlot)data.slot; if (biwoundSlot == null || biwoundSlot.m_Injury == null) { data.obj.gameObject.SetActive(false); return; } if (biwoundSlot.m_Injury.m_Type == InjuryType.Leech) { data.obj.gameObject.SetActive(false); return; } if (!data.obj.gameObject.activeSelf) { data.obj.gameObject.SetActive(true); } Vector3 screenPoint = data.slot.GetScreenPoint(); if (screenPoint.z <= 0f) { data.icon.enabled = false; return; } data.icon.rectTransform.position = screenPoint; if (biwoundSlot.GetInjury() != null && BodyInspectionController.Get() != null && BodyInspectionController.Get().enabled&& EnumTools.ConvertInjuryPlaceToLimb(biwoundSlot.GetInjury().m_Place) == HUDBodyInspection.Get().GetSelectedLimb() && biwoundSlot.GetInjury().m_Bandage == null && biwoundSlot.m_Maggots == null && biwoundSlot.GetInjury().m_ParentInjury == null) { data.icon.enabled = true; this.m_SelectedSlotData = data; return; } data.icon.enabled = false; }
public Injury AddInjury(InjuryType type, InjuryPlace place, BIWoundSlot slot, InjuryState state, int poison_level = 0, Injury parent_injury = null, DamageInfo damage_info = null) { if (!slot || PlayerConditionModule.Get().GetParameterLossBlocked()) { return(null); } if (DifficultySettings.GetActivePresetType() == DifficultySettings.PresetType.Tourist && !MainLevel.Instance.m_Tutorial) { return(null); } if (type == InjuryType.Leech && this.GetAllInjuries(type).Count == 0 && PlayerSanityModule.Get()) { PlayerSanityModule.Get().ResetEventCooldown(PlayerSanityModule.SanityEventType.Leech); } Debug.Log("AddInjury"); Injury injury = new Injury(type, place, slot, state, poison_level, parent_injury, damage_info); this.m_Injuries.Add(injury); this.OnAddInjury(type); return(injury); }
public override void OnTakeDamage(DamageInfo info) { base.OnTakeDamage(info); if (info.m_Blocked) { return; } float num = info.m_Damage; info.m_InjuryPlace = this.GetInjuryPlaceFromHit(info); if (!info.m_FromInjury) { Limb limb = EnumTools.ConvertInjuryPlaceToLimb(info.m_InjuryPlace); if (limb == Limb.None) { limb = Limb.LArm; } if (info.m_DamageType != DamageType.Fall && info.m_DamageType != DamageType.SnakePoison && info.m_DamageType != DamageType.VenomPoison && info.m_DamageType != DamageType.Insects && info.m_DamageType != DamageType.Infection) { num = info.m_Damage * (1f - PlayerArmorModule.Get().GetAbsorption(limb)); } PlayerArmorModule.Get().SetPhaseCompleted(ArmorTakeDamagePhase.InjuryModule); } float num2 = 5f; if ((num > num2 && PlayerArmorModule.Get().NoArmorAfterDamage(info)) || info.m_DamageType == DamageType.Insects || info.m_DamageType == DamageType.SnakePoison || info.m_DamageType == DamageType.VenomPoison || info.m_DamageType == DamageType.Fall || info.m_DamageType == DamageType.Infection) { BIWoundSlot biwoundSlot = null; DamageType damageType = info.m_DamageType; InjuryType injuryType; if (damageType <= DamageType.Claws) { if (damageType <= DamageType.Melee) { if (damageType - DamageType.Cut > 1) { if (damageType == DamageType.Melee) { injuryType = InjuryType.SmallWoundAbrassion; goto IL_17F; } } else { if (info.m_CriticalHit) { injuryType = InjuryType.Laceration; goto IL_17F; } injuryType = InjuryType.SmallWoundScratch; goto IL_17F; } } else { if (damageType == DamageType.VenomPoison) { injuryType = InjuryType.VenomBite; goto IL_17F; } if (damageType == DamageType.Claws) { injuryType = InjuryType.LacerationCat; goto IL_17F; } } } else if (damageType <= DamageType.Fall) { if (damageType == DamageType.Insects) { injuryType = InjuryType.Rash; goto IL_17F; } if (damageType == DamageType.Fall) { injuryType = InjuryType.SmallWoundAbrassion; goto IL_17F; } } else { if (damageType == DamageType.Critical) { injuryType = InjuryType.Laceration; goto IL_17F; } if (damageType == DamageType.SnakePoison) { injuryType = InjuryType.SnakeBite; goto IL_17F; } } injuryType = InjuryType.SmallWoundAbrassion; IL_17F: if (!info.m_FromInjury && (injuryType == InjuryType.VenomBite || injuryType == InjuryType.SnakeBite)) { Disease disease = PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Fever); if (disease != null && disease.IsActive()) { disease.IncreaseLevel(1); } else { PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.Fever, 0f, 1); } } if (info.m_DamageType == DamageType.Insects && GreenHellGame.TWITCH_DEMO) { biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LHand, injuryType, true); } else if (info.m_InjuryPlace == InjuryPlace.LLeg) { biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LLeg, injuryType, true); } else if (info.m_InjuryPlace == InjuryPlace.RLeg) { biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.RLeg, injuryType, true); } else if (info.m_InjuryPlace == InjuryPlace.LHand) { biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.LHand, injuryType, true); } else if (info.m_InjuryPlace == InjuryPlace.RHand) { biwoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(InjuryPlace.RHand, injuryType, true); } if (biwoundSlot != null) { InjuryState state = InjuryState.Open; if (injuryType == InjuryType.Laceration || injuryType == InjuryType.LacerationCat) { state = InjuryState.Bleeding; } else if (injuryType == InjuryType.WormHole) { state = InjuryState.WormInside; } this.AddInjury(injuryType, biwoundSlot.m_InjuryPlace, biwoundSlot, state, info.m_PoisonLevel, null, info); return; } if (info.m_DamageType == DamageType.VenomPoison) { for (int i = 0; i < this.m_Injuries.Count; i++) { if (this.m_Injuries[i].m_Type == InjuryType.VenomBite) { this.m_Injuries[i].m_PoisonLevel += info.m_PoisonLevel; return; } } return; } if (info.m_DamageType == DamageType.SnakePoison) { for (int j = 0; j < this.m_Injuries.Count; j++) { if (this.m_Injuries[j].m_Type == InjuryType.SnakeBite) { this.m_Injuries[j].m_PoisonLevel += info.m_PoisonLevel; return; } } } } }
public void CheckLeeches() { if (GreenHellGame.ROADSHOW_DEMO) { return; } if (PlayerConditionModule.Get().GetParameterLossBlocked() || Time.time - MainLevel.Instance.m_LevelStartTime < 20f) { return; } if (!DifficultySettings.ActivePreset.m_Leeches) { return; } if (!this.m_LeechNextTimeInitialized) { this.m_LeechNextTime2 = Injury.s_LeechCooldownInMinutes + MainLevel.Instance.GetCurrentTimeMinutes(); this.m_LeechNextTimeInitialized = true; } if (MainLevel.Instance.GetCurrentTimeMinutes() < this.m_LeechNextTime2) { return; } InjuryType injuryType; if (this.m_Player.IsInWater()) { if (this.m_LeechChanceInsideWater < UnityEngine.Random.Range(0f, 1f)) { return; } injuryType = InjuryType.Leech; } else { if (this.m_LeechChanceOutsideOfWater < UnityEngine.Random.Range(0f, 1f)) { return; } injuryType = InjuryType.Leech; } InjuryPlace place; if (this.m_Player.IsInWater() && !SwimController.Get().IsActive()) { place = (InjuryPlace)UnityEngine.Random.Range(2, 4); } else { place = (InjuryPlace)UnityEngine.Random.Range(0, 4); } int num = UnityEngine.Random.Range(1, 4); if (RainManager.Get().m_WeatherInterpolated >= 1f) { num = UnityEngine.Random.Range(3, 6); } for (int i = 0; i < num; i++) { BIWoundSlot freeWoundSlot = this.m_BodyInspectionController.GetFreeWoundSlot(place, injuryType, true); if (freeWoundSlot == null) { return; } this.AddInjury(injuryType, place, freeWoundSlot, InjuryState.Open, 0, null, null); this.m_LeechNextTime2 = Injury.s_LeechCooldownInMinutes + MainLevel.Instance.GetCurrentTimeMinutes(); } }
private void SetAdditionalInjury(Injury parent_injury) { if (this.m_Type != InjuryType.Worm) { return; } BIWoundSlot biwoundSlot = null; if (this.m_Slot.transform.name == "Wound00") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Hand_L_Wound01"); } else if (this.m_Slot.transform.name == "Wound05") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Hand_L_Wound02"); } else if (this.m_Slot.transform.name == "Wound06") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Hand_L_Wound00"); } else if (this.m_Slot.transform.name == "Wound09") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Hand_R_Wound01"); } else if (this.m_Slot.transform.name == "Wound11") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Hand_R_Wound02"); } else if (this.m_Slot.transform.name == "Wound12") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Hand_R_Wound00"); } else if (this.m_Slot.transform.name == "Wound16") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Leg_L_Wound01"); } else if (this.m_Slot.transform.name == "Wound21") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Leg_L_Wound02"); } else if (this.m_Slot.transform.name == "Wound24") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Leg_L_Wound00"); } else if (this.m_Slot.transform.name == "Wound29") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Leg_R_Wound01"); } else if (this.m_Slot.transform.name == "Wound31") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Leg_R_Wound02"); } else if (this.m_Slot.transform.name == "Wound37") { biwoundSlot = BodyInspectionController.Get().GetWoundSlot(this.m_Place, "Leg_R_Wound00"); } if (biwoundSlot != null) { PlayerInjuryModule.Get().AddInjury(InjuryType.WormHole, this.m_Place, biwoundSlot, InjuryState.WormInside, 0, parent_injury); } }