Added basic sound manager
This commit is contained in:
parent
49360ba4e8
commit
c9ca60b19f
|
@ -0,0 +1,24 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class SoundManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
private static SoundManager INSTANCE;
|
||||||
|
|
||||||
|
private AudioSource source;
|
||||||
|
|
||||||
|
void awake() {
|
||||||
|
if (SoundManager.INSTANCE == null) {
|
||||||
|
SoundManager.INSTANCE = this;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void PlaySound(AudioClip clip, float volume = 1) {
|
||||||
|
INSTANCE.source.PlayOneShot(clip, volume);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 95cd959a7274673b79164bc2664ed6e0
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in New Issue