3DSurvivalGame / Assets /Scripts /SoundManager.cs
doc2txt's picture
1
3497d64
raw
history blame contribute delete
No virus
605 Bytes
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SoundManager : MonoBehaviour
{
public static SoundManager Instance { get; set; }
public AudioSource dropItemSound;
public AudioSource grassWalkSound;
private void Awake()
{
if (Instance != null && Instance != this)
{
Destroy(gameObject);
}
else
{
Instance = this;
}
}
public void PlaySound(AudioSource sound)
{
if (sound.isPlaying == false)
{
sound.Play();
}
}
}