using UnityEngine;
using System.Collections;

public class PlayerLearnShapeScript : MonoBehaviour 
{
	public GameObject currentShape {get; set;}
	public Sprite currentSprite {get; set;}
	public ParticleSystem copyEffect;
	public CheckPlayerInteractableCollisionScript collision;

	private bool axisPressed = false;

	// Use this for initialization
	void Start () 
	{
		axisPressed = false;
	}
	
	// Update is called once per frame
	void Update () 
	{
//		Debug.Log("updating player learn script");
		// We're next to something we can interact with
		if (collision.hitInteractable != null)
		{
//			Debug.Log("interact axis: " + Input.GetAxis("Interact") + ", axisPressed: " + axisPressed);
			// We hit the interact button
			if (Input.GetAxis("Interact") != 0 && !axisPressed)
			{
				Debug.Log("getting new shape");
				copyEffect.Emit(100);
				currentShape = collision.hitInteractable.myPrefab;
				currentSprite = collision.hitInteractable.mySprite;
				axisPressed = true;
			}
			if (Input.GetAxis("Interact") == 0)
			{
				axisPressed = false;
			}
		}
	}
}
