Scoffed picnic couple audio implementation
This commit is contained in:
@@ -2,6 +2,7 @@ using UnityEngine;
|
||||
using Pixelplacement;
|
||||
using System.Collections;
|
||||
using Core;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class PicnicBehaviour : MonoBehaviour
|
||||
{
|
||||
@@ -17,6 +18,12 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
[Header("The FakeChocolate to destroy!")]
|
||||
[SerializeField] private GameObject fakeChocolate; // Assign in Inspector
|
||||
|
||||
private AudioSource _audioSource;
|
||||
public AudioResource distractedAudioClips;
|
||||
public AudioResource angryAudioClips;
|
||||
public AudioResource feederClips;
|
||||
public AudioResource moanerClips;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
@@ -26,7 +33,8 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
void Awake()
|
||||
{
|
||||
stateMachine = GetComponent<StateMachine>();
|
||||
animator = GetComponent<Animator>();
|
||||
animator = GetComponent<Animator>();
|
||||
_audioSource = GetComponent<AudioSource>();
|
||||
}
|
||||
|
||||
private IEnumerator StateCycleRoutine()
|
||||
@@ -37,21 +45,31 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
float distractedWait = Random.Range(getDistractedMin, getDistractedMax);
|
||||
stateMachine.ChangeState("Picnic PPL Distracted");
|
||||
animator.SetBool("theyDistracted", true);
|
||||
_audioSource.Stop();
|
||||
yield return new WaitForSeconds(distractedWait);
|
||||
|
||||
// Chilling state
|
||||
float chillingWait = Random.Range(getFlirtyMin, getFlirtyMax);
|
||||
stateMachine.ChangeState("Picnic PPL Chilling");
|
||||
animator.SetBool("theyDistracted", false);
|
||||
_audioSource.Stop();
|
||||
yield return new WaitForSeconds(chillingWait);
|
||||
}
|
||||
}
|
||||
|
||||
void StopAudio()
|
||||
{
|
||||
_audioSource.Stop();
|
||||
}
|
||||
|
||||
public void triedToStealChocolate()
|
||||
{
|
||||
_audioSource.Stop();
|
||||
animator.SetTrigger("theyAngry");
|
||||
//stateMachine.ChangeState("Picnic PPL Angry");
|
||||
Logging.Debug("Hey! Don't steal my chocolate!");
|
||||
_audioSource.resource = angryAudioClips;
|
||||
_audioSource.Play();
|
||||
}
|
||||
|
||||
public void destroyFakeChocolate()
|
||||
@@ -63,4 +81,23 @@ public class PicnicBehaviour : MonoBehaviour
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayFeederAudio()
|
||||
{
|
||||
_audioSource.resource = feederClips;
|
||||
_audioSource.Play();
|
||||
}
|
||||
|
||||
public void PlayMoanerAudio()
|
||||
{
|
||||
_audioSource.resource = moanerClips;
|
||||
_audioSource.Play();
|
||||
}
|
||||
|
||||
public void PlayDistractedAudio()
|
||||
{
|
||||
_audioSource.resource = distractedAudioClips;
|
||||
_audioSource.Play();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user