private void UpdateNormalMode() { if (this.m_Target == null) { Debug.Log("[CameraManager:UpdateNormalMode] Target is not set!"); return; } if (SwimController.Get().IsActive() && SwimController.Get().m_State == SwimState.Swim) { this.m_YOffset += (this.m_YSwimOffset - this.m_YOffset) * Time.deltaTime; } else { this.m_YOffset += -this.m_YOffset * Time.deltaTime; } Vector3 vector = (this.m_Target.GetREyeTransform().position + this.m_Target.GetLEyeTransform().position) * 0.5f; vector += this.m_Target.GetREyeTransform().up *this.m_YOffset; this.m_MainCamera.transform.position = vector; this.m_MainCamera.transform.rotation = this.m_Target.GetREyeTransform().rotation; if (this.m_TODRaysUpdateEnabled) { this.UpdateTodRays(); } if (this.m_InterpolateFov && !BodyInspectionController.Get().IsActive()) { this.InterpolateFov(); } }
private void UpdateBlock() { if (this.m_IsBlock != InputsManager.Get().IsActionActive(InputsManager.InputAction.Block)) { this.SetBlock(!this.m_IsBlock); } if (this.m_IsBlock) { PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.Block) * Time.deltaTime); if (PlayerConditionModule.Get().GetStamina() == 0f) { this.SetBlock(false); } else if (SwimController.Get().IsActive()) { this.SetBlock(false); } else if (Inventory3DManager.Get().gameObject.activeSelf) { this.SetBlock(false); } else if (HUDReadableItem.Get().enabled) { this.SetBlock(false); } } }
private void UpdateOxygenBar() { if (SwimController.Get() && SwimController.Get().IsActive() && SwimController.Get().m_State == SwimState.Dive) { this.m_OxygenBar.gameObject.SetActive(true); this.m_OxygenBarBG.gameObject.SetActive(true); this.m_OxygenBar.fillAmount = this.m_ConditionModule.m_Oxygen / this.m_ConditionModule.m_MaxOxygen; Color color = this.m_OxygenBar.color; if (Player.Get().m_InfinityDiving) { color.a = 0.35f; if (!this.m_InfiniteDivingIcon.gameObject.activeSelf) { this.m_InfiniteDivingIcon.gameObject.SetActive(true); } } else { color.a = 1f; if (this.m_InfiniteDivingIcon.gameObject.activeSelf) { this.m_InfiniteDivingIcon.gameObject.SetActive(false); } } this.m_OxygenBar.color = color; return; } this.m_OxygenBar.gameObject.SetActive(false); this.m_OxygenBarBG.gameObject.SetActive(false); this.m_InfiniteDivingIcon.gameObject.SetActive(false); }
public override void ConstantUpdate() { base.ConstantUpdate(); if (!this.m_Active) { return; } Player player = Player.Get(); if (player.IsDead() || SwimController.Get().IsActive() || player.m_DreamActive) { this.Deactivate(false); return; } if (BodyInspectionMiniGameController.Get().IsActive()) { this.Deactivate(false); return; } if (CutscenesManager.Get().IsCutscenePlaying()) { this.Deactivate(false); return; } if (Input.GetMouseButtonDown(0)) { this.Execute(); this.m_Active = false; base.Show(false); } }
public override string GetAdditionalInfoLocalized() { if (SwimController.Get().IsActive()) { return(string.Empty); } return(GreenHellGame.Instance.GetLocalization().Get("HUDAddInfo_BladeRequired", true)); }
public override bool CanTrigger() { if (SwimController.Get().IsActive()) { return(false); } Item currentItem = Player.Get().GetCurrentItem(Hand.Right); return(!currentItem || !currentItem.m_Info.IsHeavyObject()); }
protected override bool ShouldShow() { if (GreenHellGame.Instance.m_GameMode != GameMode.Story) { return(false); } if (ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding")) { return(false); } if (ChallengesManager.Get() && ChallengesManager.Get().IsChallengeActive()) { return(false); } if (ConsciousnessController.Get().IsActive()) { return(false); } if (SleepController.Get().IsActive()) { return(false); } if (HUDReadableItem.Get().enabled) { return(false); } if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash)) { return(false); } if (Time.time - SwimController.Get().m_LastDisableTime < 0.5f) { return(false); } if (Player.Get().m_IsInAir) { return(false); } if (HUDWheel.Get().enabled) { return(false); } if (FPPController.Get().m_Dodge) { return(false); } int shortNameHash = Player.Get().m_Animator.GetCurrentAnimatorStateInfo(1).shortNameHash; return(shortNameHash != this.m_MapWatchHideHash && shortNameHash != this.m_MapWatchIdleHash && shortNameHash != this.m_MapWatchShowHash && shortNameHash != this.m_MapZoomHash && shortNameHash != this.m_MapHideHash && shortNameHash != this.m_MapIdleHash && shortNameHash != this.m_ShowMapHash && (!DeathController.Get().IsActive() && !InsectsController.Get().IsActive() && !ScenarioManager.Get().IsDreamOrPreDream() && !Inventory3DManager.Get().IsActive() && !CutscenesManager.Get().IsCutscenePlaying() && !SwimController.Get().IsActive() && !BodyInspectionController.Get().IsActive() && !HarvestingAnimalController.Get().IsActive() && !HarvestingSmallAnimalController.Get().IsActive() && !VomitingController.Get().IsActive() && !MapController.Get().IsActive() && !NotepadController.Get().IsActive() && !MudMixerController.Get().IsActive()) && !MakeFireController.Get().IsActive()); }
public override bool CanTrigger() { if (this.m_CantTriggerDuringDialog && DialogsManager.Get().IsAnyDialogPlaying()) { return(false); } if (SwimController.Get().IsActive()) { return(false); } Item currentItem = Player.Get().GetCurrentItem(Hand.Right); return(!currentItem || !currentItem.m_Info.IsHeavyObject()); }
public override string GetIconName() { if (this.m_AI && this.m_AI.m_Trap && this.m_AI.m_Trap.m_Info.m_ID == ItemID.Snare_Trap) { return("HUD_cut_off_trap"); } if (!this.m_CanTakeToInventory && !this.m_HasBody && !SwimController.Get().IsActive()) { return("HUDTrigger_Harvest"); } if (this.m_ItemInfo == null) { return(string.Empty); } return(this.m_ItemInfo.m_IconName); }
private void UpdateAnimalsSound() { if (this.m_AnimalSoundsAudioSource == null) { return; } if (this.m_AmbientMS != null && !this.m_AmbientMS.m_Playing) { if (this.m_AnimalSoundsAudioSource != null && this.m_AnimalSoundsAudioSource.isPlaying) { this.m_AnimalSoundsAudioSource.Stop(); } return; } if (SwimController.Get().IsActive() && SwimController.Get().GetState() == SwimState.Swim) { this.m_AnimalSoundsAudioSource.volume = 0f; } else { this.m_AnimalSoundsAudioSource.volume = 1f; } if (Time.time < this.m_AnimalSoundNextTime) { return; } Vector3 position; AmbientSounds.AmbientDefinition ambientDefinition = this.SelectAmbientDefinition(out position); if (ambientDefinition != null) { this.m_AnimalSoundsAudioSource.spatialize = ambientDefinition.m_Spatialize; this.m_AnimalSoundsAudioSource.spatialBlend = ambientDefinition.m_SpatialBlend; this.m_AnimalSoundsAudioSource.minDistance = ambientDefinition.m_DistanceMin; this.m_AnimalSoundsAudioSource.maxDistance = ambientDefinition.m_DistanceMax + this.m_AmbientSounds.m_AudibilityExtraDistance; this.m_AnimalSoundsAudioSource.transform.position = position; this.m_AnimalSoundsAudioSource.clip = ambientDefinition.m_Clip; this.m_AnimalSoundsAudioSource.loop = false; this.m_AnimalSoundsAudioSource.volume = 1f; this.m_AnimalSoundsAudioSource.Play(); this.m_AnimalSoundNextTime = Time.time + ambientDefinition.m_Clip.length + UnityEngine.Random.Range(this.m_AmbientSounds.m_AmbientIntervalMin, this.m_AmbientSounds.m_AmbientIntervalMax); this.m_LastAmbient = ambientDefinition; return; } this.m_AnimalSoundNextTime = Time.time + UnityEngine.Random.Range(5f, 10f); }
private void UpdateBlock() { bool flag = InputsManager.Get().IsActionActive(InputsManager.InputAction.Block); if (this.m_IsBlock != flag && !Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash)) { this.SetBlock(!this.m_IsBlock); } if (!flag) { this.m_WasBlockBroken = false; } if (this.m_IsBlock) { this.m_LastBlockTime = Time.time; PlayerConditionModule.Get().DecreaseStamina(PlayerConditionModule.Get().GetStaminaDecrease(StaminaDecreaseReason.Block) * Time.deltaTime); if (SwimController.Get().IsActive()) { this.SetBlock(false); return; } if (Inventory3DManager.Get().gameObject.activeSelf) { this.SetBlock(false); return; } if (HUDReadableItem.Get().enabled) { this.SetBlock(false); return; } if (Player.Get().m_Animator.GetBool(Player.Get().m_CleanUpHash)) { this.SetBlock(false); } } }
private void UpdateParams() { for (int i = 0; i < this.m_Params.Count; i++) { int hash = this.m_Params[i].m_Hash; if (hash == MSMultiSample.s_DayTimeVolHash) { float value = MainLevel.Instance.m_TODSky.Cycle.Hour / 24f; this.m_ParamsMap[hash] = value; } else if (hash == MSMultiSample.s_WaterVolHash) { float value2 = (!SwimController.Get().IsActive() || SwimController.Get().m_State != SwimState.Dive) ? 0f : 1f; this.m_ParamsMap[hash] = value2; } else if (hash == MSMultiSample.s_RainVolHash) { float weatherInterpolated = RainManager.Get().m_WeatherInterpolated; this.m_ParamsMap[hash] = weatherInterpolated; } else if (hash == MSMultiSample.s_WindVolHash) { float wind = RainManager.Get().m_Wind; this.m_ParamsMap[hash] = wind; } else if (hash == MSMultiSample.s_WindPitchHash) { float wind2 = RainManager.Get().m_Wind; this.m_ParamsMap[hash] = wind2; } else if (hash == MSMultiSample.s_AreaDensityVolHash) { float areaDensity = RainManager.Get().m_AreaDensity; this.m_ParamsMap[hash] = areaDensity; } } }
private void UpdateTppMode() { if (this.m_Target == null) { Debug.Log("[CameraManager:UpdateTppMode] Target is not set!"); return; } if (SwimController.Get().IsActive() && SwimController.Get().m_State == SwimState.Swim) { this.m_YOffset += (this.m_YSwimOffset - this.m_YOffset) * Time.deltaTime; } else { this.m_YOffset += -this.m_YOffset * Time.deltaTime; } if (Input.GetKey(KeyCode.PageUp)) { this.m_TppCamDistance += 0.1f; } if (Input.GetKey(KeyCode.PageDown) && this.m_TppCamDistance > 0f) { this.m_TppCamDistance -= 0.1f; } Vector3 vector = this.m_Target.GetREyeTransform().position - this.m_Target.GetLEyeTransform().position; vector *= 0.5f; vector += this.m_Target.GetLEyeTransform().position; vector += this.m_Target.GetREyeTransform().up *this.m_YOffset; vector -= this.m_Target.GetREyeTransform().forward *this.m_TppCamDistance; this.m_MainCamera.transform.position = vector; this.m_MainCamera.transform.rotation = this.m_Target.GetREyeTransform().rotation; if (this.m_TODRaysUpdateEnabled) { this.UpdateTodRays(); } }
protected virtual bool CanBlock() { return(!FightController.s_BlockFight && !this.m_WasBlockBroken && !SwimController.Get().IsActive() && !Inventory3DManager.Get().gameObject.activeSelf&& !WatchController.Get().IsActive() && !MapController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress() && !Player.Get().m_Aim&& !CraftingController.Get().IsActive() && !Player.Get().m_Animator.GetBool(TriggerController.Get().m_BDrinkWater) && this.m_LastBlockTime <= Time.time - (PlayerConditionModule.Get().IsLowStamina() ? 1f : 0.5f) && !ScenarioManager.Get().IsDream() && !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding")); }
public void Activate() { if (CutscenesManager.Get().IsCutscenePlaying()) { return; } if (base.gameObject.activeSelf) { return; } if (BodyInspectionMiniGameController.Get().IsActive()) { return; } if (VomitingController.Get().IsActive()) { return; } if (SwimController.Get().IsActive()) { return; } if (ConsciousnessController.Get().IsActive()) { return; } if (WatchController.Get().IsActive()) { return; } if (SleepController.Get().IsActive()) { return; } if (InsectsController.Get().IsActive()) { return; } if (HarvestingAnimalController.Get().IsActive()) { return; } if (HarvestingSmallAnimalController.Get().IsActive()) { return; } if (Player.Get().IsDead()) { return; } if (HitReactionController.Get().IsActive()) { return; } if (TriggerController.Get().IsGrabInProgress()) { return; } if (HUDMovie.Get().enabled&& HUDMovie.Get().gameObject.activeSelf) { return; } if (Player.Get().m_Aim || Time.time - Player.Get().m_StopAimTime < 0.5f) { return; } base.gameObject.SetActive(true); this.BlockPlayerRotation(true); if (!Player.Get().m_BodyInspectionController.IsActive() && !CraftingManager.Get().gameObject.activeSelf) { Player.Get().StartController(PlayerControllerType.Inventory); if (Player.Get().m_ControllerToStart != PlayerControllerType.Unknown) { Player.Get().StartControllerInternal(); } } this.m_Camera.enabled = true; this.m_Canvas.gameObject.SetActive(true); CursorManager.Get().ShowCursor(true); HUDManager.Get().SetActiveGroup(HUDManager.HUDGroup.Inventory3D); this.m_CarriedItem = null; this.SetupPocket(this.m_ActivePocket); Player.Get().m_BackpackWasOpen = true; if (BodyInspectionController.Get().IsActive()) { HintsManager.Get().ShowHint("Inspection_Backpack", 10f); } this.m_ActivityChanged = true; }
private bool CanAttack() { return(!FightController.s_BlockFight && !MainLevel.Instance.IsPause() && Time.time - MainLevel.Instance.m_LastUnpauseTime >= 0.25f && !this.m_Player.IsDead() && !SwimController.Get().IsActive() && !HUDWheel.Get().enabled&& !BodyInspectionController.Get().IsActive() && !WatchController.Get().IsActive() && !NotepadController.Get().IsActive() && !MapController.Get().IsActive() && this.m_ActionAllowed && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && this.m_CurrentParam != 6 && this.m_CurrentParam != 8 && !ScenarioManager.Get().IsBoolVariableTrue("PlayerMechGameEnding") && !HUDSelectDialog.Get().enabled); }
private bool CanAttack() { return(!MainLevel.Instance.IsPause() && !this.m_Player.IsDead() && !SwimController.Get().IsActive() && !HUDWheel.Get().enabled&& !BodyInspectionController.Get().IsActive() && !WatchController.Get().IsActive() && !NotepadController.Get().IsActive() && !MapController.Get().IsActive() && this.m_ActionAllowed && !this.m_Player.GetRotationBlocked() && !Inventory3DManager.Get().gameObject.activeSelf&& !HitReactionController.Get().IsActive() && !base.IsBlock() && this.m_CurrentParam != 6 && this.m_CurrentParam != 8); }
public override void GetActions(List <TriggerAction.TYPE> actions) { if (HeavyObjectController.Get().IsActive()) { return; } base.GetActions(actions); if (this.m_CanTakeToInventory || this.m_HasBody) { actions.Add(TriggerAction.TYPE.Take); } if (this.m_Trap && this.m_Trap.m_Info.m_ID == ItemID.Snare_Trap) { actions.Add(TriggerAction.TYPE.RemoveFromSnareTrap); return; } if (!GreenHellGame.ROADSHOW_DEMO && (!this.RequiresToolToHarvest() || Player.Get().HasBlade()) && !SwimController.Get().IsActive() && !this.m_AI.m_Hallucination) { actions.Add(TriggerAction.TYPE.Harvest); } }
public override bool CanTrigger() { return((!this.m_CantTriggerDuringDialog || !DialogsManager.Get().IsAnyDialogPlaying()) && !this.m_InPlayersHand && !SwimController.Get().IsActive() && base.CanTrigger()); }
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(); } }
public void PlayFootstepSound() { if ((Player.Get().GetFPPController().m_LastCollisionFlags & CollisionFlags.Below) == CollisionFlags.None) { return; } Vector3 wantedSpeed = this.m_FPPController.m_WantedSpeed; wantedSpeed.y = 0f; if (wantedSpeed.magnitude < 0.1f) { return; } if (Time.time - this.m_LastFootstepSound < 0.1f) { return; } List <AudioClip> list = null; bool flag = Player.Get().GetFPPController().IsRunning(); EObjectMaterial eobjectMaterial = EObjectMaterial.Unknown; if (this.m_Player.IsInWater() && !this.m_Player.m_SwimController.IsActive()) { list = ((!flag) ? this.m_ShallowWaterWalkSounds : this.m_ShallowWaterRunSounds); } else { eobjectMaterial = Player.Get().GetMaterial(); switch (eobjectMaterial) { case EObjectMaterial.Unknown: case EObjectMaterial.Sand: list = ((!flag) ? this.m_SandStepWalkSounds : this.m_SandStepRunSounds); break; case EObjectMaterial.Bush: case EObjectMaterial.Grass: list = ((!flag) ? this.m_GrassStepWalkSounds : this.m_GrassStepRunSounds); break; case EObjectMaterial.Stone: list = ((!flag) ? this.m_StoneStepWalkSounds : this.m_StoneStepRunSounds); break; case EObjectMaterial.DryLeaves: list = ((!flag) ? this.m_DryLeavesStepWalkSounds : this.m_DryLeavesStepRunSounds); break; case EObjectMaterial.Mud: list = ((!flag) ? this.m_MudStepWalkSounds : this.m_MudStepRunSounds); break; case EObjectMaterial.Soil: list = ((!flag) ? this.m_SoilStepWalkSounds : this.m_SoilStepRunSounds); break; } } Noise.Type noise_type = Noise.Type.None; if (FPPController.Get().IsWalking()) { noise_type = ((!FPPController.Get().IsDuck()) ? Noise.Type.Walk : Noise.Type.Sneak); } else if (flag) { noise_type = ((!FPPController.Get().IsDuck()) ? Noise.Type.Run : Noise.Type.Sneak); } else if (SwimController.Get().IsSwimming()) { noise_type = Noise.Type.Swim; } if (list == null) { Debug.Log("ERROR PlayerAudioModule PlayFootstepSound no sounds clips player_pos=" + Player.Get().transform.position.ToString() + " Material = " + eobjectMaterial.ToString()); } this.PlayRandomSound(list, 1f, false, noise_type); this.m_LastFootstepSound = Time.time; }
protected virtual bool CanBlock() { return(!PlayerConditionModule.Get().IsStaminaCriticalLevel() && !SwimController.Get().IsActive() && !Inventory3DManager.Get().gameObject.activeSelf&& !WatchController.Get().IsActive() && !MapController.Get().IsActive() && !TriggerController.Get().IsGrabInProgress() && !Player.Get().m_Aim); }
public override bool CanExecuteActions() { return(!SwimController.Get().IsActive()); }
public override bool CanTrigger() { return(!this.m_InPlayersHands && !SwimController.Get().IsActive() && base.CanTrigger()); }
private void UpdateAudio() { if ((float)this.m_Sanity < 10f && LoadingScreen.Get().m_State == LoadingScreenState.None) { if (GreenHellGame.Instance.GetCurrentSnapshot() != AudioMixerSnapshotGame.LowSanity && !SleepController.Get().IsActive() && (!SwimController.Get().IsActive() || SwimController.Get().GetState() != SwimState.Dive)) { GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.LowSanity, 0.5f); return; } } else if (GreenHellGame.Instance.GetCurrentSnapshot() != AudioMixerSnapshotGame.Default && !SleepController.Get().IsActive() && (!SwimController.Get().IsActive() || SwimController.Get().GetState() != SwimState.Dive)) { GreenHellGame.Instance.SetSnapshot(AudioMixerSnapshotGame.Default, 0.5f); } }