You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
656 B
29 lines
656 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
[RequireComponent(typeof(AudioSource))]
|
|
public class SoundPoolPlayer : MonoBehaviour
|
|
{
|
|
public string filename;
|
|
public bool loop = true;
|
|
AudioSource audio_source = null;
|
|
|
|
private void Awake()
|
|
{
|
|
audio_source = GetComponent<AudioSource>();
|
|
audio_source.playOnAwake = false;
|
|
}
|
|
|
|
private void Start()
|
|
{
|
|
|
|
}
|
|
|
|
private void FixedUpdate()
|
|
{
|
|
if (string.IsNullOrEmpty(filename) == false)
|
|
audio_source.clip = SoundPool.Singleton.GetAudioClip(filename);
|
|
audio_source.loop = loop;
|
|
}
|
|
}
|
|
|