AnneLise bird counter implemented
This commit is contained in:
@@ -9,7 +9,8 @@
|
||||
"Unity.InputSystem",
|
||||
"Unity.TextMeshPro",
|
||||
"OptimizedRope",
|
||||
"Unity.Cinemachine"
|
||||
"Unity.Cinemachine",
|
||||
"AudioSourceEvents"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
||||
19
Assets/Scripts/PuzzleS/BirdGameStats.cs
Normal file
19
Assets/Scripts/PuzzleS/BirdGameStats.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class BirdGameStats : MonoBehaviour
|
||||
{
|
||||
public int birdsFoundInLevel;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void BirdFound()
|
||||
{
|
||||
birdsFoundInLevel += 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
2
Assets/Scripts/PuzzleS/BirdGameStats.cs.meta
Normal file
2
Assets/Scripts/PuzzleS/BirdGameStats.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 47259b63379fb1b40aa2650a13f01fd1
|
||||
8
Assets/Scripts/Sound.meta
Normal file
8
Assets/Scripts/Sound.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2a75c1b14d7422744b5db564d48f8651
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
15
Assets/Scripts/Sound/AnneLiseMain.cs
Normal file
15
Assets/Scripts/Sound/AnneLiseMain.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AnneLiseMain : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void PlayIntroVO()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Sound/AnneLiseMain.cs.meta
Normal file
2
Assets/Scripts/Sound/AnneLiseMain.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f8fad2d7a81d63b45aad87edfd322669
|
||||
16
Assets/Scripts/Sound/AudioManager.cs
Normal file
16
Assets/Scripts/Sound/AudioManager.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class AudioManager : MonoBehaviour
|
||||
{
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Sound/AudioManager.cs.meta
Normal file
2
Assets/Scripts/Sound/AudioManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8bd90cfc02c8274fac5ce090285ed6a
|
||||
55
Assets/Scripts/Sound/BushAudioController.cs
Normal file
55
Assets/Scripts/Sound/BushAudioController.cs
Normal file
@@ -0,0 +1,55 @@
|
||||
using AudioSourceEvents;
|
||||
using Input;
|
||||
using System;
|
||||
using System.Diagnostics.Tracing;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
|
||||
public class BushAudioController : MonoBehaviour
|
||||
{
|
||||
private IAudioEventSource _eventSource;
|
||||
public AudioSource VOPlayer;
|
||||
public AudioSource SFXPlayer;
|
||||
public AudioResource reactionClipToPlay;
|
||||
public AudioResource flashSFXClipToPlay;
|
||||
|
||||
public BirdGameStats birdGameStats;
|
||||
public AudioResource[] birdCounterClip;
|
||||
private int _birdCounter;
|
||||
|
||||
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
_eventSource = VOPlayer.RequestEventHandlers();
|
||||
_eventSource.AudioStopped += PlayBirdCounter;
|
||||
|
||||
}
|
||||
|
||||
public void PlayPhotoSoundBite()
|
||||
{
|
||||
VOPlayer.resource = reactionClipToPlay;
|
||||
VOPlayer.Play();
|
||||
}
|
||||
|
||||
public void PlayFlashSound()
|
||||
{
|
||||
SFXPlayer.resource = flashSFXClipToPlay;
|
||||
SFXPlayer.Play();
|
||||
}
|
||||
|
||||
private void PlayBirdCounter(object sender, EventArgs e)
|
||||
{
|
||||
VOPlayer.resource = birdCounterClip[birdGameStats.birdsFoundInLevel];
|
||||
VOPlayer.Play();
|
||||
birdGameStats.BirdFound();
|
||||
_eventSource.AudioStopped -= PlayBirdCounter;
|
||||
}
|
||||
|
||||
public void OnDisable()
|
||||
{
|
||||
// Unsubscribe from events when disabled
|
||||
_eventSource.AudioStopped -= PlayBirdCounter;
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Sound/BushAudioController.cs.meta
Normal file
2
Assets/Scripts/Sound/BushAudioController.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: edc43a9f07fedb44abb68b06c71d17ea
|
||||
35
Assets/Scripts/Sound/NarratorVO.cs
Normal file
35
Assets/Scripts/Sound/NarratorVO.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using AudioSourceEvents;
|
||||
using System;
|
||||
using UnityEngine.Events;
|
||||
|
||||
public class NarratorVO : AudioSourceObserver
|
||||
{
|
||||
public AudioSource narratorAudioSource;
|
||||
public AudioResource firstNarration;
|
||||
public UnityEvent narrationFinished;
|
||||
|
||||
private IAudioEventSource _eventSource;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
PlayNarrationAudio();
|
||||
}
|
||||
|
||||
void PlayNarrationAudio()
|
||||
{
|
||||
_eventSource = narratorAudioSource.RequestEventHandlers();
|
||||
_eventSource.AudioStopped += NarrationFinished;
|
||||
|
||||
narratorAudioSource.resource = firstNarration;
|
||||
narratorAudioSource.Play();
|
||||
}
|
||||
|
||||
private void NarrationFinished(object sender, EventArgs e)
|
||||
{
|
||||
narrationFinished.Invoke();
|
||||
}
|
||||
|
||||
}
|
||||
2
Assets/Scripts/Sound/NarratorVO.cs.meta
Normal file
2
Assets/Scripts/Sound/NarratorVO.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cb5c6632b7606ce43a0b2dbf11215dc8
|
||||
@@ -5,17 +5,20 @@ using UnityEngine;
|
||||
using UnityEngine.Audio;
|
||||
using UnityEngine.Events;
|
||||
using static Input.PlayerTouchController;
|
||||
using System;
|
||||
|
||||
|
||||
public class TakePhotoState : State
|
||||
{
|
||||
public AudioSource audioPlayer;
|
||||
public AudioResource clipToPlay;
|
||||
|
||||
public Transform playerTargetObject;
|
||||
private GameObject playerCharacter;
|
||||
private PlayerTouchController playerTouchController;
|
||||
private Vector3 newPlayerPosition;
|
||||
|
||||
|
||||
public UnityEvent animFlash;
|
||||
public UnityEvent animStart;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
playerCharacter = GameObject.FindWithTag("Player");
|
||||
@@ -26,6 +29,7 @@ public class TakePhotoState : State
|
||||
playerTouchController.InterruptMoveTo();
|
||||
playerTouchController.MoveToAndNotify(newPlayerPosition);
|
||||
InputManager.Instance.SetInputMode(InputMode.InputDisabled);
|
||||
|
||||
}
|
||||
|
||||
// When the player has arrived at the bush do Animator.SetTrigger(Takephoto) and whatevs
|
||||
@@ -42,9 +46,21 @@ public class TakePhotoState : State
|
||||
playerTouchController.OnArrivedAtTarget -= PlayerHasArrived;
|
||||
}
|
||||
|
||||
public void PlayPhotoSoundBite()
|
||||
private void OnDisable()
|
||||
{
|
||||
audioPlayer.resource = clipToPlay;
|
||||
audioPlayer.Play();
|
||||
playerTouchController.OnArrivedAtTarget -= PlayerHasArrived;
|
||||
|
||||
}
|
||||
|
||||
public void AnimStarted()
|
||||
{
|
||||
animStart.Invoke();
|
||||
}
|
||||
|
||||
public void Flash()
|
||||
{
|
||||
animFlash.Invoke();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user