public static void PlayAudio(string audioName) { if (audioName != null) { GameAudioManager.PlaySound(audioName, InterfaceManager.GetSoundEmitter()); } }
public void Start() { animation.stateChanged += OnCycleComplete; animation.TransitionTo(Reloading); GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_OPENBOLT, GameManager.GetPlayerObject()); step = ReloadStep.OpenBolt; }
public static bool Prefix(Breath __instance) { bool suppress = (bool)AccessTools.Method(typeof(Breath), "ShouldSuppressBreathEffect").Invoke(__instance, new object[0]); if (suppress) { return(false); } HeavyBreathingState heavyBreathingState = GameManager.GetFatigueComponent().GetHeavyBreathingState(); if (heavyBreathingState == HeavyBreathingState.Light) { GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHELOWINTENSITYNOLOOP, GameManager.GetPlayerObject()); } else if (heavyBreathingState == HeavyBreathingState.Medium) { GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHMEDIUMINTENSITYNOLOOP, GameManager.GetPlayerObject()); } else if (heavyBreathingState == HeavyBreathingState.Heavy) { GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHHIGHINTENSITYNOLOOP, GameManager.GetPlayerObject()); } return(false); }
private static bool Prefix(IceFishingHole __instance, GameObject go, ref float ___m_ElapsedFishingTimeMinutes) { GearItem component = go.GetComponent <GearItem>(); if (!component) { return(false); } component.gameObject.SetActive(true); component.m_CurrentHP = UnityEngine.Random.Range(0.9f * component.m_MaxHP, component.m_MaxHP); float myrol1 = FishingHoles.FishingHolesPoisson(); float myrol2 = FishingHoles.FishingHolesPoisson(); //do it twice to widen the tail of the distribution float FISHmod = (myrol1 * myrol2 + 0.25f) / 1.25f; //ensure mod is Non-zero float skillmod = GameManager.GetSkillIceFishing().GetFishWeightScale(); Debug.Log("Fish mod:" + FISHmod + "skill mod:" + skillmod + " changing " + component.name + " weight from:" + component.m_WeightKG + " to:" + component.m_WeightKG * FISHmod * skillmod); component.m_WeightKG = component.m_WeightKG * FISHmod * skillmod; float length = Mathf.Pow(component.m_WeightKG, 0.3333f); float lengthfactor = 1f; if (component.name == "GEAR_RawLakeWhiteFish") { lengthfactor = 0.8f; } if (component.name == "GEAR_RawSmallMouthBass") { lengthfactor = 0.9f; } if (component.name == "GEAR_RawRainbowTrout") { lengthfactor = 0.8f; } if (component.name == "GEAR_RawCohoSalmon") { lengthfactor = 0.74f; } component.gameObject.transform.localScale *= length * lengthfactor; component.m_FoodItem.m_CaloriesTotal *= FISHmod * skillmod; component.m_FoodItem.m_CaloriesRemaining *= FISHmod * skillmod; GameManager.GetPlayerManagerComponent().EnterInspectGearModeFromFishingHole(component, __instance); InterfaceManager.m_Panel_GenericProgressBar.Pause(); GameAudioManager.PlaySound(EVENTS.PAUSE_SEARCHCONTAINER, GameManager.GetPlayerObject()); StatsManager.IncrementValue(StatID.FishCaught, component.GetItemWeightKG()); GameManager.GetAchievementManagerComponent().CaughtFish(component); component.MarkAsHarvested(); return(false); }
internal static void Postfix() { //If P has been pressed if (InputManager.GetKeyDown(InputManager.m_CurrentContext, UnityEngine.KeyCode.P)) { //Play the sound GameAudioManager.PlaySound(SOUND_NAME, InterfaceManager.GetSoundEmitter()); } }
internal static void FeedFire(Panel_FeedFire __instance) { Fire _fire = __instance.m_Fire; string guid = Utils.GetGuidFromGameObject(_fire.gameObject); GearItem fuel = __instance.GetSelectedFuelSource(); // cool off fire with water if (fuel.name.ToLower().Contains("recycledcan") || fuel.name.ToLower().Contains("cookingpot")) { GearItem gi_wt = GameManager.GetInventoryComponent().GetPotableWaterSupply(); if (gi_wt.m_WaterSupply.m_VolumeInLiters >= 0.25f && _fire.m_HeatSource.m_MaxTempIncrease > Settings.options.waterTempRemoveDeg) { GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter()); GameAudioManager.PlaySound(gi_wt.m_PickUpAudio, InterfaceManager.GetSoundEmitter()); gi_wt.m_WaterSupply.m_VolumeInLiters -= 0.25f; _fire.ReduceHeatByDegrees(Settings.options.waterTempRemoveDeg); } else if (gi_wt.m_WaterSupply.m_VolumeInLiters < 0.25f) { HUDMessage.AddMessage("Need water in inventory.", false); GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter()); GameAudioManager.PlayGUIError(); } else { HUDMessage.AddMessage("Temperature is too low.", false); GameAudioManager.StopAllSoundsFromGameObject(InterfaceManager.GetSoundEmitter()); GameAudioManager.PlayGUIError(); } /* we consume can/pot so recreate it * we could hack it to not consume but after some time (minutes) of feed fire dialog, said object is getting corrupted in such way that it's lagging game * on each interaction with said item */ GearItem clone = Utils.InstantiateGearFromPrefabName(fuel.name); clone.m_CurrentHP = fuel.m_CurrentHP; GameManager.GetInventoryComponent().AddGear(clone.gameObject); GameManager.GetInventoryComponent().DestroyGear(fuel.gameObject); } // added fuel while embers else if (_fire.m_EmberTimer > 0f) { ResetEmbersOnRestart(_fire); } // try add fuel to embers unless it wasn't comming out from ember state. else if (fuel.name.ToLower().Contains("wood") || fuel.name.ToLower().Contains("coal")) { if (_fire.GetRemainingLifeTimeSeconds() < 39600 && (_fire.m_EmberDurationSecondsTOD < (Settings.options.embersTime * 3600))) { float fuelmove = fuel.m_FuelSourceItem.m_BurnDurationHours * Settings.options.embersFuelRatio; _fire.m_MaxOnTODSeconds -= fuelmove * 3600; _fire.m_EmberDurationSecondsTOD += (fuelmove * 3600) * Settings.options.embersFuelEx; _fire.m_BurningTimeTODHours -= fuelmove; } } }
private void MakeMistake() { if (!Implementation.Mistakes) { return; } this.offset = Random.Range(-maxMistake, maxMistake); GameAudioManager.PlaySound(MistakeAudio, this.gameObject); this.nextMistake += getRandomDelay(averageMistakeDelay); }
private static void Postfix(PlayerManager __instance, ref bool __result) { if (__instance.m_InteractiveObjectUnderCrosshair != null && __instance.m_InteractiveObjectUnderCrosshair.name == "XPZ_Switch") { HouseLights.ToggleLightsState(); GameAudioManager.PlaySound("Stop_RadioAurora", __instance.gameObject); Vector3 scale = __instance.m_InteractiveObjectUnderCrosshair.transform.localScale; __instance.m_InteractiveObjectUnderCrosshair.transform.localScale = new Vector3(scale.x, scale.y * -1, scale.z); //Play Sound __result = true; } }
public void OnCycleComplete(State oldState, State newState) { if (oldState != Reloading || newState != Reloading) { return; } switch (step) { case ReloadStep.CloseBolt: animation.stateChanged -= OnCycleComplete; reloadCompleteEventCallback?.Invoke(); animation.TransitionTo(Showing); return; case ReloadStep.OpenBolt: break; case ReloadStep.LoadClip: remainingBullets -= 5; clipLoadedEventCallback?.Invoke(); break; case ReloadStep.LoadRound: remainingBullets--; roundLoadedEventCallback?.Invoke(); break; } if (remainingBullets >= 5) { GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_CARTRIDGE_LOOP_, GameManager.GetPlayerObject()); step = ReloadStep.LoadClip; } else if (remainingBullets > 0) { GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_SINGLE_LOOP, GameManager.GetPlayerObject()); step = ReloadStep.LoadRound; } else { GameAudioManager.PlaySound(AK.EVENTS.PLAY_FPH_HUNTINGRIFLE_RELOAD_SINGLE_CLOSEBOLT, GameManager.GetPlayerObject()); step = ReloadStep.CloseBolt; } }
private static bool Prefix(IceFishingHole __instance, bool ___m_FishingInProgress, ref float ___m_ElapsedFishingTimeMinutes) { float fishingInterval = 5f; if (!___m_FishingInProgress) { return(false);; } if (GameManager.GetPlayerManagerComponent().IsInspectModeActive()) { return(false);; } if (InterfaceManager.m_Panel_GenericProgressBar.IsPaused()) { InterfaceManager.m_Panel_GenericProgressBar.Resume(); GameAudioManager.PlaySound(EVENTS.RESUME_SEARCHCONTAINER, GameManager.GetPlayerObject()); } if (___m_ElapsedFishingTimeMinutes > fishingInterval) { float myrand = UnityEngine.Random.Range(0.0f, 1.0f); float popfactor = FishingHoles.getFishingFactor(RegionManager.GetCurrentRegion(), Utils.GetGuidFromGameObject((__instance.gameObject))); float fishing_skill = GameManager.GetSkillIceFishing().ReduceFishingTimeScale(); float myprob = ((1f / fishing_skill) * popfactor) * (fishingInterval / 60f); Debug.Log("Rolling for fish, FISH catch chance (per hour avg):" + popfactor + " Skill modifier:" + (1f / fishing_skill) + " final prob:" + myprob + " rand:" + myrand); if (myrand < myprob) { if (Utils.RollChance(GameManager.GetSkillIceFishing().GetLineBreakOnChancePercent())) { AccessTools.Method(typeof(IceFishingHole), "LineBreak").Invoke(__instance, null); //CHECKTHIS } else { AccessTools.Method(typeof(IceFishingHole), "CatchFish").Invoke(__instance, null); FishingHoles.CatchInProgress(RegionManager.GetCurrentRegion(), Utils.GetGuidFromGameObject((__instance.gameObject))); } } ___m_ElapsedFishingTimeMinutes = 0; } return(false); }
private static bool Prefix(Panel_FeedFire __instance, Fire ___m_Fire, GameObject ___m_FireContainer, GearItem ___m_ResearchItemToBurn) { if ((bool)AccessTools.Method(typeof(Panel_FeedFire), "ProgressBarIsActive").Invoke(__instance, null)) { GameAudioManager.PlayGUIError(); return(false); } GearItem selectedFuelSource = (GearItem)AccessTools.Method(typeof(Panel_FeedFire), "GetSelectedFuelSource").Invoke(__instance, null); if (selectedFuelSource == null) { GameAudioManager.PlayGUIError(); return(false); } FuelSourceItem fuelSourceItem = selectedFuelSource.m_FuelSourceItem; if (fuelSourceItem == null) { GameAudioManager.PlayGUIError(); return(false); } if (!___m_FireContainer) { GameAudioManager.PlayGUIError(); return(false); } if (!___m_Fire) { return(false); } if (___m_Fire.FireShouldBlowOutFromWind()) { HUDMessage.AddMessage(Localization.Get("GAMEPLAY_TooWindyToAddFuel"), false); GameAudioManager.PlayGUIError(); return(false); } bool flag = true; if ((bool)AccessTools.Method(typeof(Panel_FeedFire), "FireInForge").Invoke(__instance, null) && fuelSourceItem.m_FireAgeMinutesBeforeAdding > 0f) { flag = false; } flag = false; //allow any duration of fire if (flag) { float num = fuelSourceItem.GetModifiedBurnDurationHours(selectedFuelSource.GetNormalizedCondition()) * 60f; float num2 = ___m_Fire.GetRemainingLifeTimeSeconds() / 60f; float num3 = (num + num2) / 60f; if (num3 > GameManager.GetFireManagerComponent().m_MaxDurationHoursOfFire) { GameAudioManager.PlayGUIError(); HUDMessage.AddMessage(Localization.Get("GAMEPLAY_CannotAddMoreFuel"), false); return(false); } } int num4 = Mathf.RoundToInt(fuelSourceItem.m_FireAgeMinutesBeforeAdding - ___m_Fire.GetUnmodifiedMinutesBurning() - 10); if (num4 >= 1) { string text = Localization.Get("GAMEPLAY_BurnTimeNeededForCoal"); text = text.Replace("{minutes}", num4.ToString()); HUDMessage.AddMessage(text, false); GameAudioManager.PlayGUIError(); return(false); } if (selectedFuelSource.m_ResearchItem && !selectedFuelSource.m_ResearchItem.IsResearchComplete()) { ___m_ResearchItemToBurn = selectedFuelSource; InterfaceManager.m_Panel_Confirmation.ShowBurnResearchNotification(() => { AccessTools.Method(typeof(Panel_FeedFire), "ForceBurnResearchItem", null, null).Invoke(__instance, null); }); return(false); } if (selectedFuelSource == GameManager.GetPlayerManagerComponent().m_ItemInHands) { GameManager.GetPlayerManagerComponent().UnequipItemInHandsSkipAnimation(); } if (selectedFuelSource == GameManager.GetPlayerManagerComponent().m_PickupGearItem) { GameManager.GetPlayerManagerComponent().ResetPickup(); } GameAudioManager.PlaySound(__instance.m_FeedFireAudio, InterfaceManager.GetSoundEmitter()); ___m_Fire.AddFuel(selectedFuelSource, (bool)AccessTools.Method(typeof(Panel_FeedFire), "FireInForge").Invoke(__instance, null)); GameManager.GetPlayerManagerComponent().ConsumeUnitFromInventory(fuelSourceItem.gameObject); return(false); }
internal static void PlayCarcassDropAudio() { GameAudioManager.PlaySound(EVENTS.PLAY_BODYFALLLARGE, InterfaceManager.GetSoundEmitter()); }
internal static void PlayCarcassPickUpAudio() { GameAudioManager.PlaySound("Play_RopeGetOn", InterfaceManager.GetSoundEmitter()); GameAudioManager.PlaySound(EVENTS.PLAY_EXERTIONLOW, InterfaceManager.GetSoundEmitter()); }
public void PlaySound(GameAudioManager.SoundType sound) { _audioManager.PlaySound(sound); }