Audio refactor almost done
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
[Header("The FakeChocolate to destroy!")]
|
||||
[SerializeField] private GameObject fakeChocolate; // Assign in Inspector
|
||||
|
||||
private AudioSource _audioSource;
|
||||
private AppleAudioSource _audioSource;
|
||||
public AudioResource distractedAudioClips;
|
||||
public AudioResource angryAudioClips;
|
||||
public AudioResource feederClips;
|
||||
@@ -34,7 +34,7 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
{
|
||||
stateMachine = GetComponent<StateMachine>();
|
||||
animator = GetComponent<Animator>();
|
||||
_audioSource = GetComponent<AudioSource>();
|
||||
_audioSource = GetComponent<AppleAudioSource>();
|
||||
}
|
||||
|
||||
private IEnumerator StateCycleRoutine()
|
||||
@@ -68,8 +68,8 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
animator.SetTrigger("theyAngry");
|
||||
//stateMachine.ChangeState("Picnic PPL Angry");
|
||||
Logging.Debug("Hey! Don't steal my chocolate!");
|
||||
_audioSource.resource = angryAudioClips;
|
||||
_audioSource.Play();
|
||||
_audioSource.audioSource.resource = angryAudioClips;
|
||||
_audioSource.Play(0);
|
||||
}
|
||||
|
||||
public void destroyFakeChocolate()
|
||||
@@ -83,20 +83,20 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
|
||||
public void PlayFeederAudio()
|
||||
{
|
||||
_audioSource.resource = feederClips;
|
||||
_audioSource.Play();
|
||||
_audioSource.audioSource.resource = feederClips;
|
||||
_audioSource.Play(0);
|
||||
}
|
||||
|
||||
public void PlayMoanerAudio()
|
||||
{
|
||||
_audioSource.resource = moanerClips;
|
||||
_audioSource.Play();
|
||||
_audioSource.audioSource.resource = moanerClips;
|
||||
_audioSource.Play(0);
|
||||
}
|
||||
|
||||
public void PlayDistractedAudio()
|
||||
{
|
||||
_audioSource.resource = distractedAudioClips;
|
||||
_audioSource.Play();
|
||||
_audioSource.audioSource.resource = distractedAudioClips;
|
||||
_audioSource.Play(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ public class SoundGenerator : MonoBehaviour
|
||||
[SerializeField] private Sprite enterSprite;
|
||||
[SerializeField] private Sprite exitSprite;
|
||||
[SerializeField] private AudioClip enterSound;
|
||||
[SerializeField] private AudioSource audioSource;
|
||||
[SerializeField] private AppleAudioSource audioSource;
|
||||
[SerializeField] private StateMachine soundBirdSMRef;
|
||||
[SerializeField] private soundBird_CanFly soundbirdHearingCheck;
|
||||
|
||||
@@ -35,7 +35,7 @@ public class SoundGenerator : MonoBehaviour
|
||||
}
|
||||
if (audioSource != null && enterSound != null)
|
||||
{
|
||||
audioSource.PlayOneShot(enterSound);
|
||||
audioSource.audioSource.PlayOneShot(enterSound);
|
||||
}
|
||||
if (soundBirdSMRef != null && soundBirdSMRef.currentState.name == "SoundBird" && soundbirdHearingCheck.canFly == true)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ public class soundBird_TakeOffBehaviour : MonoBehaviour
|
||||
private Animator animator;
|
||||
private TweenBase objectTween;
|
||||
|
||||
public AudioSource audioSource;
|
||||
public AppleAudioSource audioSource;
|
||||
|
||||
void Awake()
|
||||
{
|
||||
@@ -29,7 +29,7 @@ public class soundBird_TakeOffBehaviour : MonoBehaviour
|
||||
{
|
||||
animator.SetBool("isScared", true);
|
||||
objectTween = Tween.Spline(FlightSpline, SoundBirdObject, 0, 1, false, flightDuration, flightDelay, Tween.EaseIn, Tween.LoopType.None, HandleTweenStarted, HandleTweenFinished);
|
||||
audioSource.Play();
|
||||
audioSource.Play(0);
|
||||
}
|
||||
void HandleTweenStarted()
|
||||
{
|
||||
|
||||
@@ -150,6 +150,12 @@ public class AudioManager : MonoBehaviour, IPausable
|
||||
Debug.Log($"[AUDIOMANAGER] Playing {currentlyPlayingVO.name} as nothing is currently playing.");
|
||||
return true;
|
||||
}
|
||||
|
||||
// If the requested audio is not critical, and the currently playing audio is, tell the request to get bent
|
||||
if (requestedAudioSource.audioSourceType == AppleAudioSource.AudioSourceType.VO && currentlyPlayingVO.audioSourceType == AppleAudioSource.AudioSourceType.CriticalVO)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
// If the requested audio source is the same, interrupt and trigger it again
|
||||
if (currentlyPlayingVO == requestedAudioSource)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BushAudioController : MonoBehaviour
|
||||
public void PlayPhotoSoundBite()
|
||||
{
|
||||
VOPlayer.audioSource.resource = reactionClipToPlay;
|
||||
VOPlayer.Play(0);
|
||||
VOPlayer.Play(1);
|
||||
}
|
||||
|
||||
public void PlayFlashSound()
|
||||
|
||||
Reference in New Issue
Block a user