123456789101112131415161718192021222324 |
- using UnityEngine;
- using System.Collections;
- public class EffectSoundShoot : MonoBehaviour {
- private AudioSource audioSource;
- private float startTime;
- public float duration = float.MaxValue;
- void Start()
- {
- audioSource = GetComponent<AudioSource>();
- startTime = GameTime.time;
- }
- // Update is called once per frame
- void FixedUpdate ()
- {
- if(audioSource == null || !audioSource.isPlaying || GameTime.time - startTime >= duration)
- {
- Destroy(this.gameObject);
- }
- }
- }
|