More sounds

This commit is contained in:
2025-12-10 23:37:36 +01:00
parent 3bc12a719b
commit 75b9459157
11 changed files with 266 additions and 5 deletions

View File

@@ -12,6 +12,9 @@ public class SoundManager : UdonSharpBehaviour
[SerializeField] private AudioClip pacStart;
[SerializeField] private AudioClip pacDot1;
[SerializeField] private AudioClip pacDot2;
[SerializeField] private AudioClip pacFruit;
[SerializeField] private AudioClip pacCoin;
[SerializeField] private AudioClip pacGhostEat;
[SerializeField] private AudioClip pacGhost1;
private AudioClip nextDotSound;
@@ -32,11 +35,32 @@ public class SoundManager : UdonSharpBehaviour
nextDotSound = nextDotSound == pacDot1 ? pacDot2 : pacDot1;
}
public void PlayFruitSound()
{
PlaySound(audioSourcePlayer, pacFruit);
}
public void PlayCoinSound()
{
PlaySound(audioSourcePlayer, pacCoin);
}
public void PlayGhostEatSound()
{
PlaySound(audioSourcePlayer, pacGhostEat);
}
public void StartGhostSound()
{
PlaySound(audioSourceGhosts, pacGhost1, true);
}
public void StopAllSound()
{
audioSourcePlayer.Stop();
audioSourceGhosts.Stop();
}
private void PlaySound(AudioSource audioSource, AudioClip audioClip, bool loop = false)
{
audioSource.clip = audioClip;