/// <summary> /// Returns the room SFX. /// </summary> /// <returns>Room SFX</returns> public RoomSFX GetRoomSFX() { if (this.roomSFX == null) { if (GetComponentInChildren <RoomSFX> () != null) { this.roomSFX = GetComponentInChildren <RoomSFX> (); } } return(this.roomSFX); }
/// <summary> /// Override Play function for room SFX. /// </summary> /// <param name="name">SFX name</param> /// <param name="isLoop">If the sound will loop.</param> public void Play(AudibleNames.Room name, bool isLoop) { if (roomSFX == null) { if (GetComponentInChildren <RoomSFX> () != null) { this.roomSFX = GetComponentInChildren <RoomSFX> (); this.roomSFX.GetAudioSource(name).loop = isLoop; this.PlayOneShot(roomSFX.GetAudioSource(name)); } } else { this.roomSFX.GetAudioSource(name).loop = isLoop; this.PlayOneShot(roomSFX.GetAudioSource(name)); } }