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

public class SoundControl : MonoBehaviour {

	public AudioSource audio1;
	public AudioSource audio2;
	// Use this for initialization
	void Start () {

		if(audio1!=null)
		{
       		audio1.Play();
        }
		if(audio2!=null)
		{
        	audio2.loop = true;
        }
	}
	
	// Update is called once per frame
	void Update () {
		if(audio1 == null||!audio1.isPlaying)
		{
			if(audio2!=null&&!audio2.isPlaying)
			{
				audio2.Play();
			}
		}
	}
}
