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

public class IntercomAudio : MonoBehaviour {

	public AudioClip setupClip;
	public AudioClip thankYouClip;

	private AudioSource audio;

	public MidiControlNumbers midiControls;

	bool setupPlayed;
	bool thankYoupPlayed;

	// Use this for initialization
	void Start () {

		audio = this.GetComponent<AudioSource> ();
		setupPlayed = false;
		thankYoupPlayed = false;
	}
	
	// Update is called once per frame
	void Update ()
	{
		if (audio.isPlaying == false && setupPlayed == false)
		{
			audio.clip = setupClip;
			audio.PlayOneShot (audio.clip);
			setupPlayed = true;
		}

		if (midiControls.setupDone == true && thankYoupPlayed == false)
		{
			audio.clip = thankYouClip;
			audio.PlayOneShot (audio.clip);
			thankYoupPlayed = true;
		}
	}
}
