private void OnEat(ConsumableInfo info) { if (info.m_ConsumeEffect != ConsumeEffect.None && UnityEngine.Random.Range(0f, 1f) <= info.m_ConsumeEffectChance && info.m_ConsumeEffectLevel >= 0) { PlayerDiseasesModule.Get().RequestDisease(info.m_ConsumeEffect, info.m_ConsumeEffectDelay, info.m_ConsumeEffectLevel); } PlayerDiseasesModule.Get().OnEat(info); PlayerInjuryModule.Get().OnEat(info); if (info.m_Disgusting) { PlayerAudioModule.Get().PlayEatingDisgustingSound(1f, false); } else { PlayerAudioModule.Get().PlayEatingSound(1f, false); } EventsManager.OnEvent(Enums.Event.Eat, 1, (int)info.m_ID); PlayerSanityModule.Get().OnEat(info.m_SanityChange); Localization localization = GreenHellGame.Instance.GetLocalization(); HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages)); string text = string.Empty; if (info.m_ConsumeEffect == ConsumeEffect.FoodPoisoning) { text = info.m_ConsumeEffectLevel.ToString("F0") + " " + localization.Get("HUD_FoodPoisoning"); hudmessages.AddMessage(text, null, HUDMessageIcon.FoodPoisoning, string.Empty); } if (info.m_AddEnergy > 0f) { text = info.m_AddEnergy.ToString("F0") + " " + localization.Get("HUD_Energy"); hudmessages.AddMessage(text, null, HUDMessageIcon.Energy, string.Empty); } if (info.m_Water > 0f) { text = info.m_Water.ToString("F0") + " " + localization.Get("HUD_Hydration"); hudmessages.AddMessage(text, null, HUDMessageIcon.Hydration, string.Empty); } if (info.m_Fat > 0f) { text = info.m_Fat.ToString("F0") + " " + localization.Get("HUD_Nutrition_Fat"); hudmessages.AddMessage(text, null, HUDMessageIcon.Fat, string.Empty); } if (info.m_Proteins > 0f) { text = info.m_Proteins.ToString("F0") + " " + localization.Get("HUD_Nutrition_Protein"); hudmessages.AddMessage(text, null, HUDMessageIcon.Proteins, string.Empty); } if (info.m_Carbohydrates > 0f) { text = info.m_Carbohydrates.ToString("F0") + " " + localization.Get("HUD_Nutrition_Carbo"); hudmessages.AddMessage(text, null, HUDMessageIcon.Carbo, string.Empty); } text = localization.Get(TriggerAction.GetTextPerfect(TriggerAction.TYPE.Eat)) + ": " + info.GetNameToDisplayLocalized(); hudmessages.AddMessage(text, null, HUDMessageIcon.Item, info.m_IconName); ItemsManager.Get().OnEat(info); if (info.m_ID == ItemID.coca_leafs) { PlayerCocaineModule.Get().OnEatCocaine(); } }
private void UnlockInjuryTreatment(Item item) { if ((this.m_Injury.m_Type == InjuryType.SmallWoundAbrassion || this.m_Injury.m_Type == InjuryType.SmallWoundScratch) && item.m_Info.m_ID == ItemID.Ficus_Dressing) { PlayerInjuryModule.Get().UnlockKnownInjuryTreatment(NotepadKnownInjuryTreatment.SmallWoundFicusLeafDressing); } }
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()); }
private void UpdateDamagePP() { float num = 0f; float weight = PostProcessManager.Get().GetWeight(PostProcessManager.Effect.Blood); if (PlayerConditionModule.Get().IsHPCriticalLevel()) { num = CJTools.Math.GetProportionalClamp(0f, 1f, PlayerConditionModule.Get().GetHP(), PlayerConditionModule.Get().m_CriticalLevel, 0f); } if (this.m_LastDamageTime > 0f && Time.time - this.m_LastDamageTime < this.m_DamageEffectDuration) { num = 1f; } if (PlayerInjuryModule.Get().GetAllInjuriesOfState(InjuryState.Bleeding).Count > 0) { num = 1f; } if (weight > 0f && Time.time - this.m_LastDamageTime >= this.m_DamageEffectDuration) { num = Mathf.Max(num, weight - Time.deltaTime * 0.5f); } num = (Player.Get().m_DreamPPActive ? 0f : num); if (num != weight) { PostProcessManager.Get().SetWeight(PostProcessManager.Effect.Blood, num); } }
public override void OnReplicationPrepare() { base.OnReplicationPrepare(); foreach (ReplicatedPlayerInjuries.ReplicatedWoundSlot replicatedWoundSlot in this.m_WoundSlots) { if (replicatedWoundSlot.m_LocalPlayerInjury != null && !PlayerInjuryModule.Get().m_Injuries.Contains(replicatedWoundSlot.m_LocalPlayerInjury)) { replicatedWoundSlot.m_LocalPlayerInjury = null; replicatedWoundSlot.ClearInjury(); this.ReplSetDirty(); } } foreach (Injury injury in PlayerInjuryModule.Get().m_Injuries) { if (!this.m_PreviousInjuries.ContainsKey(injury)) { int slotIdUsingLocalPlayerSlot = this.GetSlotIdUsingLocalPlayerSlot(injury.m_Slot.gameObject); this.m_PreviousInjuries.Add(injury, this.m_WoundSlots[slotIdUsingLocalPlayerSlot]); this.m_WoundSlots[slotIdUsingLocalPlayerSlot].m_LocalPlayerInjury = injury; this.m_WoundSlots[slotIdUsingLocalPlayerSlot].SetInjury(injury.m_Type, injury.m_State); this.ReplSetDirty(); } else { ReplicatedPlayerInjuries.ReplicatedWoundSlot replicatedWoundSlot2 = this.m_PreviousInjuries[injury]; if (!replicatedWoundSlot2.HasInjury(injury)) { replicatedWoundSlot2.m_LocalPlayerInjury = injury; replicatedWoundSlot2.SetInjury(injury.m_Type, injury.m_State); this.ReplSetDirty(); } } } }
private void UpdateDebug() { if (!GreenHellGame.DEBUG) { return; } if (this.m_DebugSpawnID != ItemID.None && Input.GetKeyDown(KeyCode.I)) { this.CreateItem(this.m_DebugSpawnID, true, Player.Get().transform.position + Player.Get().transform.forward * 4f, Player.Get().transform.rotation); } if (Input.GetKey(KeyCode.U) && Input.GetKey(KeyCode.LeftControl)) { this.UnlockAllItemsInNotepad(); PlayerDiseasesModule.Get().UnlockAllDiseasesInNotepad(); PlayerDiseasesModule.Get().UnlockAllDiseasesTratmentInNotepad(); PlayerDiseasesModule.Get().UnlockAllSymptomsInNotepad(); PlayerDiseasesModule.Get().UnlockAllSymptomTreatmentsInNotepad(); PlayerInjuryModule.Get().UnlockAllInjuryState(); PlayerInjuryModule.Get().UnlockAllInjuryStateTreatment(); PlayerInjuryModule.Get().UnlockAllKnownInjuries(); this.UnloackAllConsumed(); this.UnlockAllCrafted(); this.UnlockAllBoiledData(); this.UnlockAllCollected(); this.UnlockAllItemInfos(); } }
public void WakeUp(bool force_update = false, bool unblock_moves = true) { if (force_update) { this.m_TODTime.AddHours((float)this.m_SleepDuration, true); this.CheckWorm(); this.SetupSurroundingConstructions(); } if (unblock_moves) { this.m_Player.UnblockMoves(); this.m_Player.UnblockRotation(); } this.m_StartSleepingTime = 0f; this.m_ParamsMul = 1f; this.UpdateLastWakeUpTime(); if (this.m_RestingPlace != null) { EventsManager.OnEvent(Enums.Event.Sleep, 1, this.m_SleepDuration, 1); PlayerSanityModule.Get().OnEvent(PlayerSanityModule.SanityEventType.BedSleep, 1); } else { EventsManager.OnEvent(Enums.Event.Sleep, 1, this.m_SleepDuration, 0); PlayerSanityModule.Get().OnEvent(PlayerSanityModule.SanityEventType.GroundSleep, 1); PlayerInjuryModule.Get().SleptOnGround(); } GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.Default, 0.5f); this.m_Animator.SetBool(this.m_StandUpHash, true); this.Stop(); }
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()); }
public static void LoadPlayer(string save_name) { if (SaveGame.m_State != SaveGame.State.None) { Debug.LogWarning("Can't load player, state = " + SaveGame.m_State.ToString()); return; } if (!File.Exists(Application.persistentDataPath + "/" + save_name)) { return; } Debug.Log("LOAD_PLAYER - " + save_name); SaveGame.m_State = SaveGame.State.Load; SaveGame.SetupObjects(); SaveGame.m_IVals.Clear(); SaveGame.m_SVals.Clear(); SaveGame.m_FVals.Clear(); SaveGame.m_BVals.Clear(); BinaryFormatter binaryFormatter = new BinaryFormatter(); FileStream fileStream = File.Open(Application.persistentDataPath + "/" + save_name, FileMode.Open); GameVersion lhs = new GameVersion((GameVersion)binaryFormatter.Deserialize(fileStream)); GameMode gameMode = (GameMode)binaryFormatter.Deserialize(fileStream); long num = (long)binaryFormatter.Deserialize(fileStream); int num2 = (int)binaryFormatter.Deserialize(fileStream); int num3 = (int)binaryFormatter.Deserialize(fileStream); if (lhs >= GreenHellGame.s_GameVersionEarlyAccessUpdate8) { bool flag = (bool)binaryFormatter.Deserialize(fileStream); } if (lhs >= GreenHellGame.s_GameVersionEarlyAccessUpdate12 && lhs < GreenHellGame.s_GameVersionEarlyAccessUpdate13 && (bool)binaryFormatter.Deserialize(fileStream)) { DifficultySettings.SetActivePresetType(DifficultySettings.PresetType.PermaDeath); } if (lhs >= GreenHellGame.s_GameVersionEarlyAccessUpdate13) { bool flag2 = (bool)binaryFormatter.Deserialize(fileStream); } if (GreenHellGame.s_GameVersion >= GreenHellGame.s_GameVersionMasterShelters1_3) { BinaryFormatter binaryFormatter2 = binaryFormatter; Stream serializationStream = fileStream; P2PSession instance = P2PSession.Instance; binaryFormatter2.Serialize(serializationStream, ((instance != null) ? instance.GetSessionId() : null) ?? ""); } SaveGame.m_IVals = (Dictionary <string, int>)binaryFormatter.Deserialize(fileStream); SaveGame.m_SVals = (Dictionary <string, string>)binaryFormatter.Deserialize(fileStream); SaveGame.m_FVals = (Dictionary <string, float>)binaryFormatter.Deserialize(fileStream); SaveGame.m_BVals = (Dictionary <string, bool>)binaryFormatter.Deserialize(fileStream); fileStream.Close(); Player.Get().Load(); PlayerInjuryModule.Get().Load(); PlayerConditionModule.Get().Load(); PlayerDiseasesModule.Get().Load(); ItemsManager.Get().Load(); MainLevel.Instance.Load(); GreenHellGame.Instance.m_LoadGameState = LoadGameState.FullLoadCompleted; SaveGame.m_State = SaveGame.State.None; }
protected override void CheckAutoHeal() { if (PlayerInjuryModule.Get().GetPosionLevel() > 0) { this.m_StartTime = MainLevel.Instance.GetCurrentTimeMinutes(); } base.CheckAutoHeal(); }
public void Infect() { this.SetState(InjuryState.Infected); this.SetWoundMaterial(this.m_Slot.m_Wound.gameObject); this.m_HealingStartTime = float.MaxValue; this.UpdateHealthDecreasePerSec(); this.RemoveBandage(); Player.Get().GetComponent <PlayerDiseasesModule>().RequestDisease(ConsumeEffect.Fever, 0f, 1); PlayerInjuryModule.Get().UnlockKnownInjuryState(InjuryState.Infected); }
public void OnEnterWater(WaterCollider water) { if (!this.m_CurrentWaters.Contains(water.gameObject)) { PlayerInjuryModule.Get().CheckLeeches(); if (water.m_PlayerCanSwimIn) { this.m_CurrentWaters.Add(water.gameObject); } } }
public override bool ShouldShow() { for (int i = 0; i < this.m_InjuryState.Count; i++) { if (PlayerInjuryModule.Get().IsInjuryStateUnlocked(this.m_InjuryState[i])) { return(true); } } return(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 void Push(GameObject pusher_obj, float radius, Vector3?position_offset = null) { if (!this.m_SOM) { return; } float radius2 = this.GetRadius(pusher_obj.ReplIsOwner()); foreach (KeyValuePair <StaticObjectClass, GameObject> keyValuePair in this.m_SOM.m_ReplacedMap) { GameObject value = keyValuePair.Value; if (value == null) { return; } float num = value.transform.position.Distance2D(pusher_obj.transform.position + (position_offset ?? Vector3.zero)); float def_shake_mul = 0f; float def_shake_time_mul = 0f; PushLeaves pushLeaves = null; value.GetComponents <PushLeaves>(this.m_PushLeavesCache); if (this.m_PushLeavesCache.Count > 0) { pushLeaves = this.m_PushLeavesCache[0]; } if (num < radius2 && this.GetDataByObject(value) == null && pushLeaves != null) { List <Material> materialsToModify = pushLeaves.GetMaterialsToModify(); int num2 = 0; if (num2 < materialsToModify.Count) { Material material = materialsToModify[num2]; if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeAdd)) { def_shake_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeAdd); } if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeTimeAdd)) { def_shake_time_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeTimeAdd); } } this.m_Data.Add(new LeavesPusherData(value, value.transform.rotation, pusher_obj.transform.right, radius2, value.GetComponent <PushLeaves>(), def_shake_mul, def_shake_time_mul)); if (pusher_obj.gameObject.ReplIsOwner()) { PlayerInjuryModule.Get().SetLeechNextTime(PlayerInjuryModule.Get().GetLeechNextTime() - this.m_LeechCooldownDecrease2); PlayerInjuryModule.Get().CheckLeeches(); } } } }
private void OnDrink(LiquidData data, float hydration_amount, float fat_amount, float proteins_amount, float carbo_amount, float energy_amount) { if (data.m_ConsumeEffect != ConsumeEffect.None && UnityEngine.Random.Range(0f, 1f) <= data.m_ConsumeEffectChance && data.m_ConsumeEffectLevel >= 0) { PlayerDiseasesModule.Get().RequestDisease(data.m_ConsumeEffect, data.m_ConsumeEffectDelay, data.m_ConsumeEffectLevel); } PlayerDiseasesModule.Get().OnDrink(data.m_LiquidType, hydration_amount); PlayerInjuryModule.Get().OnDrink(data); if (data.m_Disgusting) { PlayerAudioModule.Get().PlayDrinkingDisgustingSound(1f, false); } else { PlayerAudioModule.Get().PlayDrinkingSound(1f, false); } Localization localization = GreenHellGame.Instance.GetLocalization(); HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages)); string text = string.Empty; if (energy_amount > 0f) { text = energy_amount.ToString("F0") + " " + localization.Get("HUD_Energy"); hudmessages.AddMessage(text, null, HUDMessageIcon.Energy, string.Empty); } if (hydration_amount > 0f) { text = hydration_amount.ToString("F0") + " " + localization.Get("HUD_Hydration"); hudmessages.AddMessage(text, null, HUDMessageIcon.Hydration, string.Empty); } if (fat_amount > 0f) { text = fat_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Fat"); hudmessages.AddMessage(text, null, HUDMessageIcon.Fat, string.Empty); } if (proteins_amount > 0f) { text = proteins_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Protein"); hudmessages.AddMessage(text, null, HUDMessageIcon.Proteins, string.Empty); } if (carbo_amount > 0f) { text = carbo_amount.ToString("F0") + " " + localization.Get("HUD_Nutrition_Carbo"); hudmessages.AddMessage(text, null, HUDMessageIcon.Carbo, string.Empty); } text = localization.Get(TriggerAction.GetTextPerfect(TriggerAction.TYPE.Drink)) + ": " + GreenHellGame.Instance.GetLocalization().Get(data.m_LiquidType.ToString()); hudmessages.AddMessage(text, null, HUDMessageIcon.None, string.Empty); EventsManager.OnEvent(Enums.Event.Drink, 1, (int)data.m_LiquidType); }
public override bool ShouldShow() { for (int i = 0; i < this.m_InjuryTreatmentType.Count; i++) { if (this.m_InjuryTreatmentType[i] == NotepadKnownInjuryTreatment.None) { return(true); } if (PlayerInjuryModule.Get().IsInjuryTreatmentUnlocked(this.m_InjuryTreatmentType[i])) { return(true); } } return(false); }
public static void SetupObjectsCoop() { SaveGame.m_Objects.Clear(); SaveGame.m_Objects.Add(ItemsManager.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(MenuNotepad.Get()); SaveGame.m_Objects.Add(MapTab.Get()); SaveGame.m_Objects.Add(SleepController.Get()); SaveGame.m_Objects.Add(DifficultySettings.Get()); SaveGame.m_Objects.Add(InventoryBackpack.Get()); }
protected override void Start() { base.Start(); this.m_ConditionModule = Player.Get().GetComponent <PlayerConditionModule>(); DebugUtils.Assert(this.m_ConditionModule, true); this.m_NoNutritionIconStartScale = this.m_EnergyUsedByNoNutritionIcon.transform.localScale; this.m_WoundsIconStartScale = this.m_EnergyUsedByWoundsIcon.transform.localScale; this.m_FoodPoisonIconStartScale = this.m_EnergyFoodPoisonIcon.transform.localScale; this.m_PoisonIconStartScale = this.m_EnergyFoodPoisonIcon.transform.localScale; this.m_FeverIconStartScale = this.m_EnergyFeverIcon.transform.localScale; this.m_HealingWoundDummy = base.transform.FindDeepChild("HUDHealingWoundDummy"); this.m_SwimController = Player.Get().GetComponent <SwimController>(); this.ScrollerInitialize(); this.m_PIM = PlayerInjuryModule.Get(); this.m_PDM = Player.Get().GetComponent <PlayerDiseasesModule>(); this.m_HealthRed.enabled = false; }
public void Push(Vector3 pos, float radius) { if (!this.m_SOM) { return; } foreach (KeyValuePair <StaticObjectClass, GameObject> keyValuePair in this.m_SOM.m_ReplacedMap) { GameObject value = keyValuePair.Value; if (value == null) { return; } Vector3 vector = value.transform.position - pos; vector.y = 0f; float def_shake_mul = 0f; float def_shake_time_mul = 0f; PushLeaves pushLeaves = null; value.GetComponents <PushLeaves>(this.m_PushLeavesCache); if (this.m_PushLeavesCache.Count > 0) { pushLeaves = this.m_PushLeavesCache[0]; } if (vector.magnitude < this.GetRadius() && this.GetDataByObject(value) == null && pushLeaves != null) { List <Material> materialsToModify = pushLeaves.GetMaterialsToModify(); int num = 0; if (num < materialsToModify.Count) { Material material = materialsToModify[num]; if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeAdd)) { def_shake_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeAdd); } if (material.HasProperty(LeavesPusher.s_ShaderPropertyShakeTimeAdd)) { def_shake_time_mul = material.GetFloat(LeavesPusher.s_ShaderPropertyShakeTimeAdd); } } this.m_Data.Add(new LeavesPusherData(value, value.transform.rotation, Player.Get().transform.right, this.GetRadius(), value.GetComponent <PushLeaves>(), def_shake_mul, def_shake_time_mul)); PlayerInjuryModule.Get().SetLeechNextTime(PlayerInjuryModule.Get().GetLeechNextTime() - this.m_LeechCooldownDecrease2); PlayerInjuryModule.Get().CheckLeeches(); } } }
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); } }
public void OnDebug() { Player.Get().UnlockMap(); Player.Get().UnlockNotepad(); Player.Get().UnlockWatch(); ItemsManager.Get().UnlockAllItemsInNotepad(); PlayerDiseasesModule.Get().UnlockAllDiseasesInNotepad(); PlayerDiseasesModule.Get().UnlockAllDiseasesTratmentInNotepad(); PlayerDiseasesModule.Get().UnlockAllSymptomsInNotepad(); PlayerDiseasesModule.Get().UnlockAllSymptomTreatmentsInNotepad(); PlayerInjuryModule.Get().UnlockAllInjuryState(); PlayerInjuryModule.Get().UnlockAllInjuryStateTreatment(); MainLevel.Instance.m_GameMode = GameMode.Debug; GreenHellGame.Instance.m_GameMode = GameMode.None; MainLevel.Instance.Initialize(); MenuInGameManager.Get().HideMenu(); this.StartRainforestAmbienceMultisample(); }
public void Infect() { this.SetState(InjuryState.Infected); this.SetWoundMaterial(this.m_Slot.m_Wound.gameObject); this.m_HealingStartTime = float.MaxValue; this.UpdateHealthDecreasePerSec(); this.RemoveBandage(); Disease disease = PlayerDiseasesModule.Get().GetDisease(ConsumeEffect.Fever); if (disease != null && disease.IsActive()) { disease.IncreaseLevel(1); } else { PlayerDiseasesModule.Get().RequestDisease(ConsumeEffect.Fever, 0f, 1); } PlayerInjuryModule.Get().UnlockKnownInjuryState(InjuryState.Infected); }
private void UpdatePassedOut() { float num = Time.time - this.m_StartPassOutTime; this.m_Progress = num / this.m_PassOutDurationRealTime; this.m_Progress = Mathf.Clamp01(this.m_Progress); float num2 = this.m_Progress - this.m_PrevProgress; this.m_TODTime.AddHours(this.m_PassOutDuration * num2, true, false); this.m_HoursDelta = this.m_PassOutDuration * num2; int num3 = (int)(this.m_PassOutDuration * this.m_Progress); if (num3 > this.m_HourProgress) { this.CheckWorm(); } this.m_HourProgress = num3; float num4 = this.m_Progress - this.m_PrevProgress; foreach (string text in this.m_FParams.Keys) { PropertyInfo property = this.m_ConditionModule.GetType().GetProperty(text); float num5 = (float)property.GetValue(this.m_ConditionModule, null); float num6 = (this.m_FParams[text] > 0f) ? this.m_FParams[text] : this.m_FParams[text]; if (PlayerInjuryModule.Get().GetNumWounds() <= 0 || !(text == "m_HP")) { num5 += num6 * num4; } property.SetValue(this.m_ConditionModule, num5, null); } this.m_ConditionModule.ClampParams(); if (this.m_Progress >= 1f) { this.WakeUp(); } this.m_PrevProgress = this.m_Progress; if (HUDPassOut.Get().m_BG.color.a >= 1f) { AIManager.Get().DestroyAllEnemies(); } }
public static void LoadPlayer(string save_name) { if (SaveGame.m_State != SaveGame.State.None) { Debug.LogWarning("Can't load player, state = " + SaveGame.m_State.ToString()); return; } if (!File.Exists(Application.persistentDataPath + "/" + save_name)) { return; } SaveGame.m_State = SaveGame.State.Load; SaveGame.SetupObjects(); SaveGame.m_IVals.Clear(); SaveGame.m_SVals.Clear(); SaveGame.m_FVals.Clear(); SaveGame.m_BVals.Clear(); BinaryFormatter binaryFormatter = new BinaryFormatter(); FileStream fileStream = File.Open(Application.persistentDataPath + "/" + save_name, FileMode.Open); GameVersion gameVersion = new GameVersion((GameVersion)binaryFormatter.Deserialize(fileStream)); GameMode gameMode = (GameMode)binaryFormatter.Deserialize(fileStream); long num = (long)binaryFormatter.Deserialize(fileStream); int num2 = (int)binaryFormatter.Deserialize(fileStream); int num3 = (int)binaryFormatter.Deserialize(fileStream); SaveGame.m_IVals = (Dictionary <string, int>)binaryFormatter.Deserialize(fileStream); SaveGame.m_SVals = (Dictionary <string, string>)binaryFormatter.Deserialize(fileStream); SaveGame.m_FVals = (Dictionary <string, float>)binaryFormatter.Deserialize(fileStream); SaveGame.m_BVals = (Dictionary <string, bool>)binaryFormatter.Deserialize(fileStream); fileStream.Close(); Player.Get().Load(); PlayerInjuryModule.Get().Load(); PlayerConditionModule.Get().Load(); PlayerDiseasesModule.Get().Load(); ItemsManager.Get().Load(); MainLevel.Instance.Load(); GreenHellGame.Instance.m_LoadGameState = LoadGameState.FullLoadCompleted; SaveGame.m_State = SaveGame.State.None; }
private void UpdateSleeping() { float num = Time.time - this.m_StartSleepingTime; this.m_Progress = num / (float)this.m_SleepDuration; this.m_Progress = Mathf.Clamp01(this.m_Progress); float num2 = this.m_Progress - this.m_PrevProgress; this.m_TODTime.AddHours((float)this.m_SleepDuration * num2, true); this.m_HoursDelta = (float)this.m_SleepDuration * num2; int num3 = (int)((float)this.m_SleepDuration * this.m_Progress); if (num3 > this.m_HourProgress) { this.CheckWorm(); } this.m_HourProgress = num3; float num4 = this.m_Progress - this.m_PrevProgress; foreach (string text in this.m_FParams.Keys) { PropertyInfo property = this.m_ConditionModule.GetType().GetProperty(text); float num5 = (float)property.GetValue(this.m_ConditionModule, null); float num6 = (this.m_FParams[text] <= 0f) ? this.m_FParams[text] : (this.m_FParams[text] * this.m_ParamsMul); if (PlayerInjuryModule.Get().GetNumWounds() <= 0 || !(text == "m_HP")) { num5 += num6 * num4; } property.SetValue(this.m_ConditionModule, num5, null); } this.m_ConditionModule.ClampParams(); if (this.m_Progress >= 1f) { this.WakeUp(false, true); } this.SetupSurroundingConstructions(); this.m_PrevProgress = this.m_Progress; }
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); } }
public void Update() { float currentTimeMinutes = MainLevel.Instance.GetCurrentTimeMinutes(); if (Player.Get().IsInWater()) { this.m_TimeToInfect -= Time.deltaTime * 5f; } if (this.m_Type == InjuryType.SmallWoundAbrassion || this.m_Type == InjuryType.SmallWoundScratch || this.m_Type == InjuryType.WormHole) { if (this.m_State == InjuryState.Open) { if (currentTimeMinutes < this.m_HealingStartTime) { if (currentTimeMinutes - this.m_StartTimeInMinutes > this.m_TimeToInfect) { this.Infect(); } } else if (currentTimeMinutes - this.m_HealingStartTime > this.GetHealingDuration()) { PlayerInjuryModule.Get().HealInjury(this); } } else if (this.m_State == InjuryState.Infected && currentTimeMinutes - this.m_HealingStartTime > this.GetHealingDuration()) { this.Disinfect(); } } else if (this.m_Type == InjuryType.Leech) { if (currentTimeMinutes > this.m_HealingStartTime) { PlayerInjuryModule.Get().HealInjury(this); } } else if (this.m_Type == InjuryType.VenomBite || this.m_Type == InjuryType.SnakeBite) { if (currentTimeMinutes - this.m_StartTimeInMinutes > Injury.s_PoisonAutoDebufTime) { this.PoisonDebuff(1); this.m_StartTimeInMinutes = currentTimeMinutes; } if (this.m_PoisonLevel == 0) { this.RemoveBandage(); this.m_HealingStartTime = float.MaxValue; PlayerInjuryModule.Get().HealInjury(this); } if (currentTimeMinutes - this.m_HealingStartTime > this.GetHealingDuration()) { this.PoisonDebuff(this.m_Slot.m_PoisonDebuff); this.RemoveBandage(); this.m_HealingStartTime = float.MaxValue; if (this.m_PoisonLevel == 0) { PlayerInjuryModule.Get().HealInjury(this); } } } else if (this.m_Type == InjuryType.Laceration || this.m_Type == InjuryType.LacerationCat) { if (this.m_State == InjuryState.Bleeding) { if (!this.m_Healing) { DamageInfo damageInfo = new DamageInfo(); float num = 1f; if (SleepController.Get().IsActive()) { num = PlayerInjuryModule.GetSleepTimeFactor(); damageInfo.m_Damage = num * 0.2f; } else { damageInfo.m_Damage = Time.deltaTime * 0.2f * num; } damageInfo.m_PlayDamageSound = false; Player.Get().TakeDamage(damageInfo); } if (this.m_HealingResultInjuryState == InjuryState.Infected && currentTimeMinutes - this.m_HealingStartTime > 20f) { this.Infect(); } } else if (this.m_State == InjuryState.Open) { if (this.m_HealingResultInjuryState == InjuryState.None) { if (currentTimeMinutes - this.m_HealingStartTime > 20f) { PlayerInjuryModule.Get().HealInjury(this); } } else if (currentTimeMinutes < this.m_HealingStartTime && currentTimeMinutes - this.m_StartTimeInMinutes > this.m_TimeToInfect) { this.Infect(); } } else if (this.m_State == InjuryState.Infected) { if (currentTimeMinutes - this.m_HealingStartTime > Injury.s_HealingLacerationBleedingDurationInMinutes) { this.Disinfect(); } } else if (this.m_State == InjuryState.Closed && currentTimeMinutes - this.m_HealingStartTime > Injury.s_HealingLacerationBleedingDurationInMinutes) { PlayerInjuryModule.Get().HealInjury(this); } if (currentTimeMinutes - this.m_HealingStartTime > Injury.s_HealingLacerationBleedingDurationInMinutes) { if (this.m_HealingResultInjuryState == InjuryState.Open) { this.OpenWound(); } } else if (currentTimeMinutes - this.m_HealingStartTime > 0f && this.m_HealingResultInjuryState == InjuryState.Closed) { this.CloseWound(); } } else if (this.m_Type == InjuryType.Rash) { if (currentTimeMinutes - this.m_StartTimeInMinutes > this.GetHealingDuration()) { PlayerInjuryModule.Get().HealInjury(this); } } else if (this.m_Type == InjuryType.Worm && currentTimeMinutes - this.m_HealingStartTime > 0f) { PlayerInjuryModule.Get().OpenChildrenInjuries(this); PlayerInjuryModule.Get().HealInjury(this); } if (this.m_Type == InjuryType.Leech && Time.time > this.m_EffectLastTime + this.m_EffectCooldown) { this.m_EffectLastTime = Time.time; } }
protected override void Update() { base.Update(); PlayerInjuryModule playerInjuryModule = PlayerInjuryModule.Get(); PlayerConditionModule playerConditionModule = PlayerConditionModule.Get(); for (int i = 0; i < this.m_WoundParameters.Count; i++) { if (i < playerInjuryModule.m_Injuries.Count) { Injury injury = playerInjuryModule.m_Injuries[i]; this.m_WoundParameters[i].enabled = true; this.m_WoundParameters[i].text = "Type: " + injury.m_Type.ToString(); if (injury.m_Type == InjuryType.SmallWoundAbrassion) { Text text = this.m_WoundParameters[i]; text.text = text.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString(); Text text2 = this.m_WoundParameters[i]; text2.text = text2.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString(); } else if (injury.m_Type == InjuryType.SmallWoundScratch) { Text text3 = this.m_WoundParameters[i]; text3.text = text3.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString(); Text text4 = this.m_WoundParameters[i]; text4.text = text4.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString(); } else if (injury.m_Type == InjuryType.Laceration || injury.m_Type == InjuryType.LacerationCat) { Text text5 = this.m_WoundParameters[i]; text5.text = text5.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString(); Text text6 = this.m_WoundParameters[i]; text6.text = text6.text + " Will transform to: " + injury.m_HealingResultInjuryState.ToString(); } else if (injury.m_Type == InjuryType.VenomBite) { Text text7 = this.m_WoundParameters[i]; text7.text = text7.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString(); Text text8 = this.m_WoundParameters[i]; text8.text = text8.text + " PoisonLevel: " + injury.m_PoisonLevel.ToString(); } else if (injury.m_Type == InjuryType.SnakeBite) { Text text9 = this.m_WoundParameters[i]; text9.text = text9.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString(); Text text10 = this.m_WoundParameters[i]; text10.text = text10.text + " PoisonLevel: " + injury.m_PoisonLevel.ToString(); } else if (injury.m_Type == InjuryType.Rash) { Text text11 = this.m_WoundParameters[i]; text11.text = text11.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_StartTimeInMinutes)).ToString(); Text text12 = this.m_WoundParameters[i]; text12.text = text12.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString(); } else if (injury.m_Type == InjuryType.WormHole) { Text text13 = this.m_WoundParameters[i]; text13.text = text13.text + " TimeToHeal:" + (injury.GetHealingDuration() - (MainLevel.Instance.GetCurrentTimeMinutes() - injury.m_HealingStartTime)).ToString(); Text text14 = this.m_WoundParameters[i]; text14.text = text14.text + " HealTimeBonus: " + injury.m_HealingTimeDec.ToString(); } } else { this.m_WoundParameters[i].enabled = false; } } WaterCollider waterPlayerInside = WaterBoxManager.Get().GetWaterPlayerInside(); this.m_LeechCooldownText.text = "Leech chance: "; if (waterPlayerInside == null) { Text leechCooldownText = this.m_LeechCooldownText; leechCooldownText.text += "None"; } else { Text leechCooldownText2 = this.m_LeechCooldownText; leechCooldownText2.text += waterPlayerInside.m_LeechChance.ToString(); } Text leechCooldownText3 = this.m_LeechCooldownText; leechCooldownText3.text = leechCooldownText3.text + " Time to next leech: " + (playerInjuryModule.GetLeechNextTime() - MainLevel.Instance.GetCurrentTimeMinutes()).ToString(); Text leechCooldownText4 = this.m_LeechCooldownText; leechCooldownText4.text = leechCooldownText4.text + " CoolDown: " + Injury.s_LeechCooldownInMinutes.ToString(); this.m_HPText.text = "HP = " + playerConditionModule.GetHP().ToString() + "/" + playerConditionModule.GetMaxHP().ToString(); this.m_ConditionText.text = "Condition = " + playerConditionModule.GetEnergy().ToString() + "/" + playerConditionModule.GetMaxEnergy().ToString(); playerConditionModule.m_NutritionProteins = this.m_Proteins.value; playerConditionModule.m_NutritionFat = this.m_Fat.value; playerConditionModule.m_NutritionCarbo = this.m_Carbo.value; playerConditionModule.m_Hydration = this.m_Hydration.value; playerConditionModule.m_HP = this.m_HP.value; playerConditionModule.m_Energy = this.m_Energy.value; PlayerSanityModule.Get().m_Sanity = (int)this.m_Sanity.value; }
public void OnHealAllInjuries() { PlayerInjuryModule.Get().ResetInjuries(); }