﻿using UnityEngine;
using System.Collections;


public class HitSound : MonoBehaviour {
	public AudioClip audioClip;
	//public AudioSource au_collision;
	public bool played;
	// Use this for initialization
	void Start () {
		played = false;
		audioClip = (AudioClip)Resources.Load ("SFX/NFF-alien-hit");
		//au_collision = (AudioSource)gameObject.AddComponent ("AudioSource");
		//audioClip = (AudioClip)Resources.Load ("SFX/NFF-alien-hit");
		//au_collision.enabled = false;
	}
	
	// Update is called once per frame
	void Update () {
	
	}

	/*void OnTriggerEnter(Collider hit)
	{
		if (hit.gameObject.tag == "Player")
		{

			AudioSource.PlayClipAtPoint(audioClip, collider.transform.position);

			//audio.PlayOneShot(audioClip);
			/*if(played == false){
				au_collision.clip = audioClip;
				au_collision.enabled = true;
				au_collision.loop = false;
				au_collision.Play();
				played = true;
				Debug.Log("Acertou");
			}
			AudioSource audioSource = gameObject.AddComponent<AudioSource>();
			audioSource.enabled = true;
			audioSource.clip = Resources.Load("SFX/NFF-alien-hit") as AudioClip;
			audioSource.Play();


		}
	}*/

	/*void OnCollisionEnter2D(Collision2D coll){
		
		if (coll.gameObject.tag == "Player") {
			//AudioSource.PlayClipAtPoint(audioClip, coll.collider.transform.position);	
		}
		
		
		
	}*/


}
