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

public class PickUp : MonoBehaviour {

    public int value;
    public bool special;
    public float speed;
    public bool canMove=false;
    public int index;
	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () 
    {
        this.transform.position -= new Vector3(speed, 0, 0);	
        if(this.transform.position.x<0)
        {            
            if (canMove)
            {
                GameObject.Find("PickupSpawner").GetComponent<PickupController>().ResetSpawnPoint(index);
                Destroy(this.gameObject);
            }
            
        }
	}
}
