public static void StopSound(HandleVector <int> .Handle handle) { if (!((UnityEngine.Object)Get() == (UnityEngine.Object)null)) { Sound data = Get().sounds.GetData(handle); if (data.IsPlaying) { data.ev.stop(STOP_MODE.ALLOWFADEOUT); data.ev.release(); SoundDescription soundEventDescription = KFMOD.GetSoundEventDescription(data.path); SoundDescription.Parameter[] parameters = soundEventDescription.parameters; for (int i = 0; i < parameters.Length; i++) { SoundDescription.Parameter parameter = parameters[i]; LoopingSoundParameterUpdater value = null; if (Get().parameterUpdaters.TryGetValue(parameter.name, out value)) { LoopingSoundParameterUpdater.Sound sound = default(LoopingSoundParameterUpdater.Sound); sound.ev = data.ev; sound.path = data.path; sound.description = soundEventDescription; sound.transform = data.transform; LoopingSoundParameterUpdater.Sound sound2 = sound; value.Remove(sound2); } } } Get().sounds.Free(handle); } }
public HandleVector <int> .Handle Add(string path, Vector2 pos, Transform transform = null, bool pause_on_game_pause = true, bool enable_culling = true, bool enable_camera_scaled_position = true) { SoundDescription soundEventDescription = KFMOD.GetSoundEventDescription(path); Sound.Flags flags = (Sound.Flags) 0; if (pause_on_game_pause) { flags |= Sound.Flags.PAUSE_ON_GAME_PAUSED; } if (enable_culling) { flags |= Sound.Flags.ENABLE_CULLING; } if (enable_camera_scaled_position) { flags |= Sound.Flags.ENABLE_CAMERA_SCALED_POSITION; } KBatchedAnimController animController = null; if ((UnityEngine.Object)transform != (UnityEngine.Object)null) { animController = transform.GetComponent <KBatchedAnimController>(); } Sound sound = default(Sound); sound.transform = transform; sound.animController = animController; sound.falloffDistanceSq = soundEventDescription.falloffDistanceSq; sound.path = path; sound.pos = pos; sound.flags = flags; sound.firstParameter = HashedString.Invalid; sound.secondParameter = HashedString.Invalid; Sound initial_data = sound; return(sounds.Allocate(initial_data)); }
private SoundDescription GetSoundDescription(HashedString path) { return(KFMOD.GetSoundEventDescription(path)); }