using UnityEngine;
using System.Collections;

public class SoundEffect_S : MonoBehaviour {
	AudioClip effect;
	float volume = 1f;
	float lifeTime = 5f;
	bool ignore = false;
	public void SetEffect(AudioClip newEffect){
		effect = newEffect;
	}
	public void SetVolume(float newVolume){
		volume = newVolume;
	}
	public void SetIgnoreVolume(bool ignore){
		this.ignore = ignore;
	}
	void Start(){
		audio.clip = effect;
		audio.volume = volume;
		audio.ignoreListenerVolume = ignore;
		audio.Play();
	}
	void Update(){
		lifeTime -= Time.deltaTime;
		if(lifeTime < 0){
			Destroy(gameObject);
		}
	}

}
