static void Postfix(ZSFX __instance) { string name = GetZSFXName(__instance); if (dumpInfo.Value) { Dbgl($"Checking SFX: {name}"); } if (customSFXList.ContainsKey(name)) { if (dumpInfo.Value) { Dbgl($"replacing SFX list by name: {name}"); } __instance.m_audioClips = customSFXList[name].Values.ToArray(); return; } for (int i = 0; i < __instance.m_audioClips.Length; i++) { if (dumpInfo.Value) { Dbgl($"checking SFX: {name}, clip: {__instance.m_audioClips[i].name}"); } if (customSFX.ContainsKey(__instance.m_audioClips[i].name)) { if (dumpInfo.Value) { Dbgl($"replacing SFX: {name}, clip: {__instance.m_audioClips[i].name}"); } __instance.m_audioClips[i] = customSFX[__instance.m_audioClips[i].name]; } } }
static void Postfix(ZSFX __instance) { if (dumpSFX.Value) { Dbgl($"Checking SFX: { __instance.name}"); } if (customSFXList.ContainsKey(__instance.name.Replace("(Clone)", ""))) { Dbgl($"replacing SFX list by name: { __instance.name}"); __instance.m_audioClips = customSFXList[__instance.name].ToArray(); return; } for (int i = 0; i < __instance.m_audioClips.Length; i++) { if (dumpSFX.Value) { Dbgl($"checking SFX: { __instance.name}, clip: {__instance.m_audioClips[i].name}"); } if (customSFX.ContainsKey(__instance.m_audioClips[i].name)) { Dbgl($"replacing SFX: { __instance.name}, clip: {__instance.m_audioClips[i].name}"); __instance.m_audioClips[i] = customSFX[__instance.m_audioClips[i].name]; } } }
public static void MuteTamedWolfListener(ZSFX sfx, ref bool shouldMute) { try { if (shouldMute) { return; } if (!sfx.name.Contains(SfxIdentifiers.WolfHowl)) { return; } if (Random.Range(0, 100) > KeezyBetterWolves.ConfigMuteTamedWolvesHowlPercentage.Value) { return; } foreach (var wolf in from wolfCharacter in Character.GetAllCharacters() .FindAll(AnimalConditionals.IsCharacterAWolf) where Vector3.Distance(wolfCharacter.GetTransform().position, sfx.transform.position) < 30 select new Wolf(wolfCharacter) into wolf where wolf.IsTamed() select wolf) { shouldMute = true; } } catch (Exception exception) { throw new Exception(ExceptionMessages.MuteWolfAttempt); } }
private static bool Prefix(ref ZSFX __instance) { var shouldMute = false; ZSFXPlayEvent?.Invoke(__instance, ref shouldMute); return(!shouldMute); }
// Token: 0x060009F8 RID: 2552 RVA: 0x0004829C File Offset: 0x0004649C private void UpdateRandomAmbient(float dt) { if (this.InMenu()) { return; } this.m_randomAmbientTimer += dt; if (this.m_randomAmbientTimer > this.m_randomAmbientInterval) { this.m_randomAmbientTimer = 0f; if (UnityEngine.Random.value <= this.m_randomAmbientChance) { AudioClip audioClip = this.SelectRandomAmbientClip(); if (audioClip) { Vector3 randomAmbiencePoint = this.GetRandomAmbiencePoint(); GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.m_randomAmbientPrefab, randomAmbiencePoint, Quaternion.identity, base.transform); gameObject.GetComponent <AudioSource>().pitch = UnityEngine.Random.Range(this.m_randomMinPitch, this.m_randomMaxPitch); ZSFX component = gameObject.GetComponent <ZSFX>(); component.m_audioClips = new AudioClip[] { audioClip }; component.Play(); component.FadeOut(); } } } }
public static string GetZSFXName(ZSFX zfx) { string name = zfx.name; char[] anyOf = new char[] { '(', ' ' }; int num = name.IndexOfAny(anyOf); if (num != -1) { return(name.Remove(num)); } return(name); }
//Used to get the sound effect. public static GameObject getPingAudio() { if (pingAudio == null) { GameObject fetch = ZNetScene.instance.GetPrefab("sfx_lootspawn"); pingAudio = UnityEngine.Object.Instantiate <GameObject>(fetch); ZSFX audioModule = pingAudio.GetComponent <ZSFX>(); //Adjusting the audio settings to give it some cool reverb. audioModule.m_minPitch = 0.8F; audioModule.m_maxPitch = 0.85F; audioModule.m_distanceReverb = true; audioModule.m_vol = 1F; audioModule.m_useCustomReverbDistance = true; audioModule.m_customReverbDistance = 10F; audioModule.m_delay = 1; audioModule.m_time = 1; } return(pingAudio); }
public static void AdjustTamedWolfVolume(ZSFX sfx, ref bool shouldMute) { try { if (shouldMute) { return; } if (!sfx.name.Contains(SfxIdentifiers.WolfHowl)) { return; } var configVolume = KeezyBetterWolves.ConfigMuteTamedWolvesHowlVolumePercentage.Value; var volumeMultiplier = configVolume / 100f; sfx.m_maxVol *= volumeMultiplier; sfx.m_minVol *= volumeMultiplier; } catch (Exception exception) { throw new Exception(ExceptionMessages.AdjustTamedWolfVolume); } }
public static GameObject Get( //string ownerName = "RRRN_Ashe", string weaponName = "BowHuntsman", string projectileName = "bow_projectile_frost" ) { bool alreadyExisted = false; GameObject clone = RRRLateLoadPrefabs.CloneRepeatable(ref alreadyExisted, weaponName, "AsheBow4", regOdb: true); if (alreadyExisted) { return(clone); } Transform transform = clone.transform; transform.localScale = new Vector3(1.1f, 1.1f, 1.1f); ItemDrop component = clone.GetComponent <ItemDrop>(); if ((UnityEngine.Object)component == (UnityEngine.Object)null) { throw new NullReferenceException("No ItemDrop component in prefab: " + weaponName); } ItemDrop.ItemData.SharedData shared = component.m_itemData.m_shared; shared.m_name = "Ashe Bow"; shared.m_description = "Ashe's Mighty Ultimate!"; shared.m_useDurability = false; shared.m_ammoType = ""; shared.m_attackForce = 2f; shared.m_damages.m_frost = 60f; shared.m_damages.m_pierce = 0; shared.m_aiAttackRange = 50f; shared.m_aiAttackRangeMin = 16f; shared.m_aiAttackInterval = 40f; //shared.m_aiAttackInterval = 8f; shared.m_aiAttackMaxAngle = 13f; shared.m_attack.m_projectileVel = 4f; GameObject ulty = RRRLateLoadPrefabs.Clone("bow_projectile_frost", "newFrosty", true, true); Projectile projectile = ulty.GetComponent <Projectile>(); projectile.m_gravity = 0f; projectile.m_aoe = 1.5f; projectile.m_hitEffects.m_effectPrefabs[0].m_scale = true; projectile.m_hitEffects.m_effectPrefabs[1].m_scale = true; GameObject boom = RRRLateLoadPrefabs.Clone("sfx_ice_destroyed", "newIce", true, true); ZSFX zSFX = boom.GetComponent <ZSFX>(); zSFX.m_minVol = 20f; zSFX.m_maxVol = 25f; zSFX.m_minPitch = 1.3f; zSFX.m_maxPitch = 1.5f; zSFX.m_useCustomReverbDistance = true; zSFX.m_customReverbDistance = 50f; projectile.m_hitEffects.m_effectPrefabs[0].m_prefab = boom; shared.m_attack.m_attackProjectile = ulty; Transform transformProj = ulty.transform; transformProj.localScale = new Vector3(3.5f, 3.5f, 2f); return(clone); }