AnneLise bird counter implemented

This commit is contained in:
2025-10-20 13:57:38 +02:00
parent 6e5a6c049f
commit b49bb43f79
22 changed files with 520 additions and 11 deletions

View File

@@ -9,7 +9,8 @@
"Unity.InputSystem",
"Unity.TextMeshPro",
"OptimizedRope",
"Unity.Cinemachine"
"Unity.Cinemachine",
"AudioSourceEvents"
],
"includePlatforms": [],
"excludePlatforms": [],

View 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;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 47259b63379fb1b40aa2650a13f01fd1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2a75c1b14d7422744b5db564d48f8651
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View 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()
{
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f8fad2d7a81d63b45aad87edfd322669

View 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()
{
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: d8bd90cfc02c8274fac5ce090285ed6a

View 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;
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: edc43a9f07fedb44abb68b06c71d17ea

View 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();
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: cb5c6632b7606ce43a0b2dbf11215dc8

View File

@@ -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();
}
}