skeleton-wars/Assets/AudioManager/Audio.cs
falc@null.net 632ebfca7d lol
2016-10-30 19:17:58 +01:00

16 lines
424 B
C#

using UnityEngine;
using System.Collections;
public class Audio : MonoBehaviour {
AudioSource aus;
// Use this for initialization
public void PlaySoundOnce (AudioClip song){
StartCoroutine (PlaySoundCoroutine (song));
}
IEnumerator PlaySoundCoroutine(AudioClip sound){
aus = GetComponent<AudioSource> ();
aus.PlayOneShot (sound);
yield return new WaitForSeconds (sound.length);
Destroy (gameObject);
}
}