using UnityEngine;
using System.Collections;

public class Projectile : MonoBehaviour
{
	public static GameObject Blocker	= null;

	public float FREQ					= 0.5f;
	private float m_time				= 0.5f;

	void Start ()
	{
	
	}
	
	void Update ()
	{
		m_time += Time.deltaTime;

		if ( Clicked() && null == Blocker )
		{
			if ( m_time > FREQ )
			{
				m_time = 0;
				CreateBanana();
			}
		}
	}

	void CreateBanana()
	{
		GameObject Obj = Instantiate( Resources.Load( "obj_banana" ) ) as GameObject;
	}

	bool Clicked()
	{
		return Input.GetMouseButton( 0 ) || Input.GetKey( KeyCode.Z );
	}
}
