Initial commit
This commit is contained in:
28
Assets/Scripts/SoundManager.cs
Normal file
28
Assets/Scripts/SoundManager.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
|
||||
using UdonSharp;
|
||||
using UnityEngine;
|
||||
using VRC.SDKBase;
|
||||
using VRC.Udon;
|
||||
|
||||
public class SoundManager : UdonSharpBehaviour
|
||||
{
|
||||
[SerializeField] private AudioSource audioSourcePlayer;
|
||||
|
||||
[SerializeField] private AudioClip pacManDot1;
|
||||
[SerializeField] private AudioClip pacManDot2;
|
||||
|
||||
private AudioClip nextDotSound;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
nextDotSound = pacManDot2;
|
||||
}
|
||||
|
||||
public void PlayPelletSound()
|
||||
{
|
||||
audioSourcePlayer.clip = nextDotSound;
|
||||
audioSourcePlayer.Play();
|
||||
|
||||
nextDotSound = nextDotSound == pacManDot1 ? pacManDot2 : pacManDot1;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user