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); } } }
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); } }
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); }
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(); } }
void Start() { if (audioSource == null) { audioSource = this.GetComponent <AudioSource> (); } swimController = (swimController == null) ? GetComponent <SwimController>() : swimController; }
public override string GetAdditionalInfoLocalized() { if (SwimController.Get().IsActive()) { return(string.Empty); } return(GreenHellGame.Instance.GetLocalization().Get("HUDAddInfo_BladeRequired", true)); }
void Start() { orgClimbSpeed = climbSpeed; moveController = (moveController == null) ? GetComponent <MovementController>() : moveController; swimController = (swimController == null) ? GetComponent <SwimController>() : swimController; weaponManager = (weaponManager == null) ? GetComponentInChildren <WeaponManagerNew>() : weaponManager; playerManager = dontDestroy.currentGameManager.GetComponent <PlayerManager>(); }
void Start() { mc = (mc == null) ? this.transform.root.GetComponent <MovementController>() : mc; if (audioSource == null) { audioSource = this.GetComponent <AudioSource> (); } swimController = (swimController == null) ? GetComponent <SwimController>() : swimController; }
protected override void Update() { SwimController component = GetTarget().GetComponent <SwimController>(); if (component != null) { component.SetSurfaceHeight(SurfaceHeight); } Completed(); }
public override bool CanTrigger() { if (SwimController.Get().IsActive()) { return(false); } Item currentItem = Player.Get().GetCurrentItem(Hand.Right); return(!currentItem || !currentItem.m_Info.IsHeavyObject()); }
private IEnumerator InitializeBubbleCoroutine(string path, GameObject prefab) { bubble = UnityEngine.Object.Instantiate(prefab); bubble.SetActive(value: false); Transform jnt = null; while (jnt == null) { jnt = base.transform.Find("hips_jnt/backbone_jnt/chest_jnt/neck_jnt"); yield return(new WaitForEndOfFrame()); } CameraFacingController cameraFacingController = bubble.GetComponent <CameraFacingController>(); if (cameraFacingController != null) { cameraFacingController.AttachPoint = jnt; bubble.transform.SetParent(base.gameObject.transform, worldPositionStays: false); } else { bubble.transform.SetParent(jnt.transform, worldPositionStays: false); bubble.transform.position = jnt.transform.position; } bubble.SetActive(value: true); swimController = GetComponent <SwimController>(); bubbleMaterial = bubble.GetComponentInChildren <MeshRenderer>().material; float totalAirQuantity = 10f - AirThreshold; warningThreshold = AirThreshold + totalAirQuantity * 0.4f; dangerThreshold = AirThreshold + totalAirQuantity * 0.2f; bubbleState = getStartingBubbleState(AirSupply); updateBubbleState(); if (isLocalPlayer) { CoroutineRunner.Start(UpdateLocalPlayerBubbleCoRoutine(), this, "UpdateLocalPlayerBubbleCoRoutine"); CoroutineRunner.Start(SyncAirSupplyNetwork(), this, "SyncAirSupplyNetwork"); yield break; } DataEntityHandle handle = GetComponent <AvatarDataHandle>().Handle; if (!handle.IsNull) { AirBubbleData component = dataEntityCollection.GetComponent <AirBubbleData>(handle); if (component != null) { dataEntityCollection.GetComponent <AirBubbleData>(handle).AirBubbleChanged += OnRemotePlayerAirBubbleChanged; } else { Log.LogError(this, "Failed to get the air bubble data for the remote player"); } } }
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 enableSwimController(bool isActive) { if (swimControl == null) { swimControl = penguinObj.GetComponent <SwimController>(); } if (swimControl != null) { swimControl.Active = isActive; dispatcher.DispatchEvent(new DivingEvents.FreeAirEffects(isActive, penguinObj.tag)); } else { Log.LogError(this, "No SwimController component found"); } }
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(!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 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(); } }
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); }
void Start() { orgClimbSpeed = climbSpeed; moveController = (moveController == null) ? GetComponent <MovementController>() : moveController; swimController = (swimController == null) ? GetComponent <SwimController>() : swimController; }
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; }
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); } }
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); }
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 override bool CanTrigger() { return(!this.m_InPlayersHands && !SwimController.Get().IsActive() && base.CanTrigger()); }
public override bool CanExecuteActions() { return(!SwimController.Get().IsActive()); }