using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GazScript : MonoBehaviour
{
    [SerializeField]
    float p_myLifeTime;
    float p_myTimer;
    [SerializeField]
    AudioSource p_myAudioSource;

    void Start()
    {
        p_myAudioSource = GameObject.FindGameObjectWithTag("Sound").transform.GetChild(7).GetComponent<AudioSource>();
        if (!p_myAudioSource.isPlaying)
        {
            p_myAudioSource.Play();
        }
        p_myTimer = RandomManager.getFloatRandom(p_myLifeTime);
        StartCoroutine(LifeTime());
    }

    IEnumerator LifeTime()
    {
        yield return new WaitForSeconds(p_myTimer);
        Destroy(this.gameObject);
    }
}