private AmbientSoundFilter InstantiateAndPlay(AmbientSoundFilter source, Transform root, float delay) { AmbientSoundFilter filter = Instantiate <AmbientSoundFilter>(source); Transform instanceTransform = filter.transform; this.ApplyParentTransformData(instanceTransform, root); if (delay > 0f) { filter.Play(delay); return(filter); } filter.Play(-1f); return(filter); }
public void InitAmbientMapSoundEffect(MapAmbientSoundPlayEvent evt, NonAmbientMapSoundListenerNode listener, [JoinAll] SingleNode <AmbientMapSoundEffectMarkerComponent> mapEffect) { AmbientSoundFilter ambientMapSound = Object.Instantiate <AmbientSoundFilter>(mapEffect.component.AmbientSoundFilter); Transform transform = ambientMapSound.transform; transform.parent = listener.soundListener.transform; transform.localPosition = Vector3.zero; transform.localRotation = Quaternion.identity; ambientMapSound.Play(-1f); listener.Entity.AddComponent(new AmbientMapSoundEffectComponent(ambientMapSound)); }