public AudioSource PlayEnviroSE(int clipID, int idx, float fadeTime = 0.0f) { List <SoundPack.Data2D> source; if (!this._env3DSEData.TryGetValue(clipID, out source) || source.IsNullOrEmpty <SoundPack.Data2D>() || (idx < 0 || source.Count <= idx)) { return((AudioSource)null); } SoundPack.Data2D data2D = source[idx]; AudioClip clip = this.Load((SoundPack.IData)data2D); if (Object.op_Equality((Object)clip, (Object)null)) { return((AudioSource)null); } AudioSource audioSource = Illusion.Game.Utils.Sound.Play(Manager.Sound.Type.ENV, clip, fadeTime); if (Object.op_Equality((Object)audioSource, (Object)null)) { return((AudioSource)null); } string bundle = data2D.AssetBundleName; string asset = data2D.AssetName; SoundPack.AddCountUsedEnviroSEInfo(bundle, asset, clip); ObservableExtensions.Subscribe <Unit>((IObservable <M0>)ObservableTriggerExtensions.OnDestroyAsObservable((Component)audioSource), (System.Action <M0>)(_ => SoundPack.RemoveUsedEnviroSEInfo(bundle, asset))); return(audioSource); }
public virtual void PlayMoveSE(bool open) { if (!Singleton <Manager.Map> .IsInstance() || !Singleton <Resources> .IsInstance()) { return; } Transform transform = ((Component)Manager.Map.GetCameraComponent())?.get_transform(); if (Object.op_Equality((Object)transform, (Object)null)) { return; } SoundPack soundPack = Singleton <Resources> .Instance.SoundPack; DoorMatType key; SoundPack.DoorSEIDInfo doorSeidInfo; if (!DoorAnimData.MatTable.TryGetValue(this._id, ref key) || !soundPack.DoorIDTable.TryGetValue(key, out doorSeidInfo)) { return; } int clipID = !open ? doorSeidInfo.CloseID : doorSeidInfo.OpenID; SoundPack.Data3D data; if (!soundPack.TryGetActionSEData(clipID, out data)) { return; } Vector3 position = ((Component)this).get_transform().get_position(); float num = Mathf.Pow(data.MaxDistance + soundPack.Game3DInfo.MarginMaxDistance, 2f); Vector3 vector3 = Vector3.op_Subtraction(position, transform.get_position()); float sqrMagnitude = ((Vector3) ref vector3).get_sqrMagnitude(); if ((double)num < (double)sqrMagnitude) { return; } AudioSource audioSource = soundPack.Play((SoundPack.IData)data, Sound.Type.GameSE3D, 0.0f); if (Object.op_Equality((Object)audioSource, (Object)null)) { return; } audioSource.Stop(); ((Component)audioSource).get_transform().set_position(position); audioSource.Play(); }
private void PlayWarpSE(int clipID, Transform t) { if (!Singleton <Manager.Map> .IsInstance() || !Singleton <Resources> .IsInstance()) { return; } Transform transform = ((Component)Manager.Map.GetCameraComponent())?.get_transform(); if (Object.op_Equality((Object)transform, (Object)null)) { return; } SoundPack soundPack = Singleton <Resources> .Instance.SoundPack; SoundPack.Data3D data; if (!soundPack.TryGetActionSEData(clipID, out data)) { return; } Vector3 position = t.get_position(); float num = Mathf.Pow(data.MaxDistance + soundPack.Game3DInfo.MarginMaxDistance, 2f); Vector3 vector3 = Vector3.op_Subtraction(position, transform.get_position()); float sqrMagnitude = ((Vector3) ref vector3).get_sqrMagnitude(); if ((double)num < (double)sqrMagnitude) { return; } AudioSource audioSource = soundPack.Play((SoundPack.IData)data, Sound.Type.GameSE3D, 0.0f); if (Object.op_Equality((Object)audioSource, (Object)null)) { return; } audioSource.Stop(); ((Component)audioSource).get_transform().set_position(position); audioSource.Play(); }