using UnityEngine;
using System.Collections;

public class BoomerangUpgrade : MonoBehaviour {

	public GameObject boomerangPrefab;
    public static bool canDie;
	// There is a cooldown on the boomerang, You can throw multiple boomerangs, but only when the one you threw is returning
	public bool canThrowBoomerang;

	// Use this for initialization
	void Start () {
		canThrowBoomerang = true;
	}

	// Update is called once per frame
	void Update () {
		if(canThrowBoomerang && Input.GetKeyDown(KeyCode.Alpha1))
		{
			
            canDie = true;
			GameObject newBoomerang = (GameObject)Instantiate (boomerangPrefab, this.transform.position, Quaternion.Euler(0,0,0));
			newBoomerang.GetComponent<Boomerang> ().target = Camera.main.ScreenToWorldPoint (Input.mousePosition);
			canThrowBoomerang = false;
		}
	}
}