public static void MakeWorldSound(IItemOfInterest source, MasterAudio.SoundType soundType, string soundName) { IAudible audibleSource = (IAudible)source.gameObject.GetComponent(typeof(IAudible)); if (audibleSource != null) { MakeWorldSound(audibleSource, soundType, soundName); } }
public static void MakeWorldSound(IAudible Source, List <Collider> ignoreColliders, MasterAudio.SoundType SoundType) { //use master audio to create a sound //attach an audible bubble to the source AudibleBubble audibleBubble = null; AudioSource sourceAudio = null; if (MasterAudio.PlaySound(SoundType, Source.transform, Source.AudibleVolume, ref sourceAudio)) { Source.LastSoundType = SoundType; audibleBubble = sourceAudio.gameObject.GetOrAdd <AudibleBubble> (); audibleBubble.StartUsing(Source, ignoreColliders, 0.25f); } }
public static void MakeWorldSound(IAudible source, MasterAudio.SoundType soundType, string soundName) { //use master audio to create a sound //attach an audible bubble to the source AudibleBubble audibleBubble = null; AudioSource sourceAudio = null; if (MasterAudio.PlaySound(soundType, source.transform, source.AudibleVolume, ref sourceAudio, soundName)) { source.LastSoundType = soundType; source.LastSoundName = soundName; audibleBubble = sourceAudio.gameObject.GetOrAdd <AudibleBubble> (); audibleBubble.StartUsing(source, null, 0.25f); } }
public void HearSound(IAudible source, MasterAudio.SoundType type, string sound) { //Debug.Log ("Potentially heard sound in " + name + ", it's a " + source.IOIType.ToString ()); //first see if it's in audible range if (source.IsAudible && IsInAudibleRange(worlditem.tr.position, source.Position, AwarenessDistanceTypeToAudibleDistance(State.AudioAwarnessDistance), source.AudibleRange)) { //if it's in range AND we're able to hear it //Debug.Log ("Yup definitely heard it"); if (IsAudible(worlditem.tr.position, source.Position, AwarenessDistanceTypeToAudibleSensitivity(State.AudioSensitivity), source.AudibleVolume)) { LastHeardPlayer = null; LastHeardItemOfInterest = null; switch (source.IOIType) { case ItemOfInterestType.Player: LastHeardPlayer = source.player; HeardPlayerGizmo = 1f; break; case ItemOfInterestType.WorldItem: LastHeardWorldItem = source.worlditem; break; default: break; } LastHeardItemOfInterest = source; if (LastHeardPlayer != null) { OnHearPlayer.SafeInvoke(); } if (LastHeardWorldItem != null) { OnHearWorldItem.SafeInvoke(); } OnHearItemOfInterest.SafeInvoke(); } else { source.ListenerFailToHear(); } } }
protected IEnumerator RustleOverTime(Collider otherCollider) { if (otherCollider != null) { //if the thing that's rustling us is an IAudible, we want it to make the noise, not us audibleThing = (IAudible)otherCollider.GetComponent(typeof(IAudible)); if (audibleThing == null) { audibleThing = this; } } else { audibleThing = this; } AudioManager.MakeWorldSound(audibleThing, mIgnoreColliders, LastSoundType); windZone.transform.localScale = Vector3.one * SecondaryCollider.radius * 2; windZone.transform.localPosition = SecondaryCollider.transform.localPosition; windZone.GetComponent <Animation>().enabled = true; windZone.GetComponent <Animation>()["WindZoneRustle"].wrapMode = WrapMode.ClampForever; windZone.GetComponent <Animation>().Rewind("WindZoneRustle"); windZone.GetComponent <Animation>().Play("WindZoneRustle"); while (windZone.GetComponent <Animation>().IsPlaying("WindZoneRustle")) { yield return(null); if (windZone.GetComponent <Animation>()["WindZoneRustle"].normalizedTime > 1f) { windZone.GetComponent <Animation>().enabled = false; yield break; } } mRustling = false; yield break; }