public static InjuryType CreateInjuryType(string injuryTypeId) { InjuryType injuryType = new InjuryType(); injuryType.InjuryTypeId = injuryTypeId; return(injuryType); }
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 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 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++; }
public InjuryTreatment GetTreatment(InjuryType type) { InjuryTreatment result = null; this.m_Treatments.TryGetValue((int)type, out result); return(result); }
private void LoadScript() { ScriptParser scriptParser = new ScriptParser(); scriptParser.Parse("Player/Player_InjuryTreatments", true); for (int i = 0; i < scriptParser.GetKeysCount(); i++) { Key key = scriptParser.GetKey(i); if (key.GetName() == "Treatment") { InjuryType key2 = (InjuryType)Enum.Parse(typeof(InjuryType), key.GetVariable(0).SValue); InjuryTreatment injuryTreatment = new InjuryTreatment(); string svalue = key.GetVariable(1).SValue; if (svalue != null) { string[] array = svalue.Split(new char[] { ';' }); for (int j = 0; j < array.Length; j++) { string[] array2 = array[j].Split(new char[] { '*' }); ItemID item = (ItemID)Enum.Parse(typeof(ItemID), array2[0]); injuryTreatment.AddItem(item, (array2.Length > 1) ? int.Parse(array2[1]) : 1); } } this.m_Treatments[(int)key2] = injuryTreatment; } } }
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 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(); } }
/// <summary> /// 伤势类型 /// </summary> /// <returns>The injury name.</returns> /// <param name="type">Type.</param> public static string GetInjuryName(InjuryType type) { if (injuryNameMapping.ContainsKey(type)) { return(injuryNameMapping[type]); } return(""); }
public bool IsInjuryOfType(InjuryType injury_type) { for (int i = 0; i < this.m_InjuryType.Count; i++) { if (this.m_InjuryType[i] == injury_type) { return(true); } } return(false); }
public List <Injury> GetAllInjuries(InjuryType type) { this.m_InjuriesTempList.Clear(); for (int i = 0; i < this.m_Injuries.Count; i++) { if (this.m_Injuries[i].GetInjuryType() == type) { this.m_InjuriesTempList.Add(this.m_Injuries[i]); } } return(this.m_InjuriesTempList); }
public void UnlockAllKnownInjuries() { Array values = Enum.GetValues(typeof(InjuryType)); for (int i = 0; i < values.Length; i++) { InjuryType item = (InjuryType)i; if (!this.m_KnownInjuries.Contains(item)) { this.m_KnownInjuries.Add(item); } } }
public int GetNumWoundsOfType(InjuryType type) { int num = 0; for (int i = 0; i < this.m_Injuries.Count; i++) { if (this.m_Injuries[i].IsWound() && this.m_Injuries[i].m_Type == type) { num++; } } return(num); }
public void UnlockKnownInjury(InjuryType injury_type) { if (injury_type == InjuryType.WormHole) { return; } if (!this.m_KnownInjuries.Contains(injury_type)) { this.m_KnownInjuries.Add(injury_type); HUDInfoLog hudinfoLog = (HUDInfoLog)HUDManager.Get().GetHUD(typeof(HUDInfoLog)); string title = GreenHellGame.Instance.GetLocalization().Get("HUD_InfoLog_NewEntry", true); string text = GreenHellGame.Instance.GetLocalization().Get(injury_type.ToString(), true); hudinfoLog.AddInfo(title, text, HUDInfoLogTextureType.Notepad); } }
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); } }
internal override void Export(string table) { base.Export(table); table = GetType().Name; var vals = new List <object> { Id, HfId_Woundee.DBExport(), HfId_Wounder.DBExport(), SiteId.DBExport(), SubregionId.DBExport(), FeatureLayerId.DBExport(), BodyPart.DBExport(), InjuryType.DBExport(), PartLost.DBExport() }; Database.ExportWorldItem(table, vals); }
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 OnReplicationDeserialize(P2PNetworkReader reader, bool initial_state) { base.OnReplicationDeserialize(reader, initial_state); this.Initialize(); foreach (ReplicatedPlayerInjuries.ReplicatedWoundSlot replicatedWoundSlot in this.m_WoundSlots) { replicatedWoundSlot.m_IsValid = false; } int num = (int)reader.ReadPackedUInt32(); for (int i = 0; i < num; i++) { InjuryType injury_type = (InjuryType)reader.ReadInt32(); InjuryState injury_state = (InjuryState)reader.ReadInt32(); int num2 = reader.ReadInt32(); this.m_WoundSlots[num2].m_IsValid = true; if (num2 >= 0 && num2 < this.m_WoundSlots.Count) { this.m_WoundSlots[num2].SetInjury(injury_type, injury_state); } } }
/// <summary> /// 获取伤势颜色 /// </summary> /// <returns>The injury color.</returns> /// <param name="type">Type.</param> public static Color GetInjuryColor(InjuryType type) { switch (type) { case InjuryType.None: default: return(new Color(0, 1, 0, 1)); case InjuryType.White: return(new Color(1, 1, 1, 1)); case InjuryType.Yellow: return(new Color(1, 1, 0, 1)); case InjuryType.Purple: return(new Color(1, 0, 1, 1)); case InjuryType.Red: return(new Color(1, 0, 0, 1)); case InjuryType.Moribund: return(new Color(0.5f, 0, 0, 1)); } }
public bool IsInjuryUnlocked(InjuryType injury_type) { return(this.m_KnownInjuries.Contains(injury_type)); }
public void UnlockKnownInjuryFromScenario(string injury_type_name) { InjuryType injury_type = (InjuryType)Enum.Parse(typeof(InjuryType), injury_type_name); this.UnlockKnownInjury(injury_type); }
public bool HasInjury(InjuryType injury_type, InjuryState injury_state) { return(this.m_InjuryData.type == injury_type && this.m_InjuryData.state == injury_state); }
public SReplicatedInjuryData(InjuryType type, InjuryState state) { this.type = type; this.state = state; }
public static void SetWoundMaterial(GameObject obj, InjuryState state, InjuryType type) { if (obj == null) { return; } Renderer componentDeepChild = General.GetComponentDeepChild <Renderer>(obj); switch (type) { case InjuryType.SmallWoundAbrassion: if (state == InjuryState.Open) { componentDeepChild.material = (Resources.Load("Decals/wound_abrasion", typeof(Material)) as Material); return; } if (state == InjuryState.Infected) { componentDeepChild.material = (Resources.Load("Decals/wound_abrasion_infected", typeof(Material)) as Material); return; } break; case InjuryType.SmallWoundScratch: if (state == InjuryState.Open) { componentDeepChild.material = (Resources.Load("Decals/wound_scratch", typeof(Material)) as Material); return; } if (state == InjuryState.Infected) { componentDeepChild.material = (Resources.Load("Decals/wound_scratch_infected", typeof(Material)) as Material); return; } break; case InjuryType.Laceration: if (state == InjuryState.Bleeding) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration", typeof(Material)) as Material); return; } if (state == InjuryState.Open) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration", typeof(Material)) as Material); return; } if (state == InjuryState.Infected) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration_infected", typeof(Material)) as Material); return; } if (state == InjuryState.Closed) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration_closed", typeof(Material)) as Material); return; } break; case InjuryType.LacerationCat: if (state == InjuryState.Bleeding) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration_cat", typeof(Material)) as Material); return; } if (state == InjuryState.Open) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration_cat", typeof(Material)) as Material); return; } if (state == InjuryState.Infected) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration_cat_infected", typeof(Material)) as Material); return; } if (state == InjuryState.Closed) { componentDeepChild.material = (Resources.Load("Decals/wound_laceration_cat_closed", typeof(Material)) as Material); return; } break; case InjuryType.Rash: componentDeepChild.material = (Resources.Load("Decals/wound_rash", typeof(Material)) as Material); return; case InjuryType.Worm: case InjuryType.Leech: case InjuryType.LeechHole: break; case InjuryType.WormHole: if (state == InjuryState.WormInside) { componentDeepChild.material = (Resources.Load("Decals/wound_worm_hole_closed", typeof(Material)) as Material); return; } if (state == InjuryState.Open) { componentDeepChild.material = (Resources.Load("Decals/wound_worm_leech_hole", typeof(Material)) as Material); return; } if (state == InjuryState.Infected) { componentDeepChild.material = (Resources.Load("Decals/wound_worm_hole_infected", typeof(Material)) as Material); } break; case InjuryType.VenomBite: componentDeepChild.material = (Resources.Load("Decals/wound_venom_bite", typeof(Material)) as Material); return; case InjuryType.SnakeBite: componentDeepChild.material = (Resources.Load("Decals/wound_snake_bite", typeof(Material)) as Material); return; default: return; } }
private void OnAddInjury(InjuryType type) { this.UnlockKnownInjury(type); }
public Wound(BodyPart part, InjuryType type, int severity) { this.part = part; this.type = type; this.severity = severity; }
public void SetInjury(InjuryType injury_type, InjuryState injury_state) { if (this.HasInjury(injury_type, injury_state)) { return; } this.m_InjuryData = new ReplicatedPlayerInjuries.SReplicatedInjuryData(injury_type, injury_state); if (injury_type != InjuryType.None) { this.m_ReplicatedPlayerSlot.SetActive(true); } Injury.SetWoundMaterial(this.m_ReplicatedPlayerSlot, injury_state, injury_type); if (this.m_ReplicatedPlayerAdditionalMeshes != null) { for (int i = 0; i < this.m_ReplicatedPlayerAdditionalMeshes.Count; i++) { Injury.SetWoundMaterial(this.m_ReplicatedPlayerAdditionalMeshes[i], injury_state, injury_type); } } if (injury_type == InjuryType.Worm) { GameObject gameObject = Resources.Load("Prefabs/Items/Item/botfly") as GameObject; if (gameObject == null) { gameObject = (Resources.Load("Prefabs/TempPrefabs/Item/Item/botfly") as GameObject); } if (gameObject == null) { return; } this.m_AdditionalObjectInSlot = UnityEngine.Object.Instantiate <GameObject>(gameObject, this.m_ReplicatedPlayerSlot.transform.position, this.m_ReplicatedPlayerSlot.transform.rotation); Item component = this.m_AdditionalObjectInSlot.GetComponent <Item>(); if (component != null) { component.m_CanSaveNotTriggered = false; } this.m_AdditionalObjectInSlot.layer = Player.Get().gameObject.layer; this.m_AdditionalObjectInSlot.transform.parent = this.m_ReplicatedPlayerSlot.transform; this.m_AdditionalObjectInSlot.GetComponent <Parasite>().m_InBody = true; Renderer[] componentsDeepChild = General.GetComponentsDeepChild <Renderer>(this.m_AdditionalObjectInSlot); for (int j = 0; j < componentsDeepChild.Length; j++) { componentsDeepChild[j].gameObject.layer = LayerMask.NameToLayer("Player"); } this.m_AdditionalObjectInSlot.SetActive(false); return; } else { if (injury_type != InjuryType.Leech) { if (injury_type == InjuryType.VenomBite || injury_type == InjuryType.SnakeBite || injury_type == InjuryType.Laceration || injury_type == InjuryType.LacerationCat || injury_type == InjuryType.Rash || injury_type == InjuryType.SmallWoundAbrassion || injury_type == InjuryType.SmallWoundScratch || injury_type == InjuryType.WormHole) { this.m_ReplicatedPlayerSlot.SetActive(true); if (injury_type == InjuryType.Rash && this.m_ReplicatedPlayerAdditionalMeshes != null) { for (int k = 0; k < this.m_ReplicatedPlayerAdditionalMeshes.Count; k++) { this.m_ReplicatedPlayerAdditionalMeshes[k].SetActive(true); } return; } } else { Item component2 = this.m_ReplicatedPlayerSlot.GetComponent <Item>(); if (component2 != null && component2.m_Info == null) { UnityEngine.Object.Destroy(component2.gameObject); } if (component2 != null && component2.m_Info != null && component2.m_Info.m_ID == ItemID.Leech) { UnityEngine.Object.Destroy(component2.gameObject); } else if (component2 == null || (component2 != null && component2.m_Info != null && component2.m_Info.m_ID != ItemID.Leech && component2.m_Info.m_ID != ItemID.Botfly)) { this.m_ReplicatedPlayerSlot.SetActive(false); } if (this.m_ReplicatedPlayerAdditionalMeshes != null) { for (int l = 0; l < this.m_ReplicatedPlayerAdditionalMeshes.Count; l++) { this.m_ReplicatedPlayerAdditionalMeshes[l].SetActive(false); } } if (this.m_AdditionalObjectInSlot) { UnityEngine.Object.Destroy(this.m_AdditionalObjectInSlot); this.m_AdditionalObjectInSlot = null; } } return; } GameObject gameObject2 = Resources.Load("Prefabs/Items/Item/Leech") as GameObject; if (gameObject2 == null) { gameObject2 = (Resources.Load("Prefabs/TempPrefabs/Items/Item/Leech") as GameObject); } if (gameObject2 == null) { return; } this.m_AdditionalObjectInSlot = UnityEngine.Object.Instantiate <GameObject>(gameObject2, this.m_ReplicatedPlayerSlot.transform.position, this.m_ReplicatedPlayerSlot.transform.rotation); Item component3 = this.m_AdditionalObjectInSlot.GetComponent <Item>(); if (component3 != null) { component3.m_CanSaveNotTriggered = false; } this.m_AdditionalObjectInSlot.layer = Player.Get().gameObject.layer; this.m_AdditionalObjectInSlot.GetComponent <Rigidbody>().useGravity = false; this.m_AdditionalObjectInSlot.transform.parent = this.m_ReplicatedPlayerSlot.transform; this.m_AdditionalObjectInSlot.GetComponent <Animator>().speed = UnityEngine.Random.Range(0.8f, 1.2f); this.m_AdditionalObjectInSlot.GetComponent <Parasite>().m_InBody = true; this.m_AdditionalObjectInSlot.GetComponent <Rigidbody>().detectCollisions = false; this.m_AdditionalObjectInSlot.GetComponent <Animator>().SetBool("Drink", true); Renderer[] componentsDeepChild = General.GetComponentsDeepChild <Renderer>(this.m_AdditionalObjectInSlot); for (int j = 0; j < componentsDeepChild.Length; j++) { componentsDeepChild[j].gameObject.layer = LayerMask.NameToLayer("Player"); } return; } }