You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.4 KiB
C#
50 lines
1.4 KiB
C#
using UnityEngine;
|
|
|
|
public class SoundManager : MonoBehaviour
|
|
{
|
|
public static SoundManager Instance;
|
|
|
|
[Header("Audio Clips")]
|
|
public AudioClip inboxDing;
|
|
public AudioClip officeFootsteps;
|
|
public AudioClip officeAmbience;
|
|
public AudioClip buttonClick;
|
|
public AudioClip phishingAlert;
|
|
public AudioClip hackedAlert;
|
|
public AudioClip typewriterSubtitle;
|
|
public AudioClip correctAction;
|
|
|
|
public AudioSource audioSource;
|
|
|
|
void Awake()
|
|
{
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
//DontDestroyOnLoad(gameObject);
|
|
audioSource = GetComponent<AudioSource>();
|
|
if (audioSource == null)
|
|
audioSource = gameObject.AddComponent<AudioSource>();
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public void PlayInboxDing() => audioSource.PlayOneShot(inboxDing);
|
|
|
|
public void PlayOfficeFootsteps() => audioSource.PlayOneShot(officeFootsteps);
|
|
|
|
public void PlayOfficeAmbience() => audioSource.PlayOneShot(officeAmbience);
|
|
|
|
public void PlayButtonClick() => audioSource.PlayOneShot(buttonClick);
|
|
|
|
public void PlayPhishingAlert() => audioSource.PlayOneShot(phishingAlert);
|
|
|
|
public void PlayTypewriterSubtitle() => audioSource.PlayOneShot(typewriterSubtitle);
|
|
|
|
public void PlayCorrectAction() => audioSource.PlayOneShot(correctAction);
|
|
public void PlayHacked() => audioSource.PlayOneShot(hackedAlert);
|
|
}
|