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

public class PickUps : MonoBehaviour {
	public Transform playerPos;
	public float distancePlayer; //distance between enemy and player
	public int ID;

	#region New
	public int amount;
	#endregion
	
	// Use this for initialization
	void Start () {
		playerPos = GameObject.Find("Player").GetComponent<Transform>(); //getting player's transform values.
		
		#region New
		if(amount == 0)
		{
			amount = 1;
		}
		#endregion
	}
	
	// Update is called once per frame
	void Update () {
		distancePlayer = Vector3.Distance(playerPos.position,transform.position);

		if(Input.GetKeyDown(KeyCode.E) && distancePlayer < 2)
		{
			GameObject.Find("Player").GetComponent<Inventory>().inv[ID].Amount ++;
			Destroy(this.gameObject);
		}
	}
}
