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

public class Pickable : MonoBehaviour {

	bool IsPicked = false;
	Socket InSocket;

	// Use this for initialization
	void Start () {
		
	}
	
	// Update is called once per frame
	void Update () {
		
	}

	public void Pick() {
		Rigidbody RBCube = GetComponent<Rigidbody>();
		if(RBCube) RBCube.isKinematic = true;
		Collider RBCol = GetComponent<Collider>();
		if(RBCol) RBCol.isTrigger = true;
		if(InSocket) {
			InSocket.Slot = null;
			InSocket = null;
		}
	}

	public void Drop(Socket Target) {
		if(Target) {
			transform.position = Target.transform.position;
			transform.rotation = Target.transform.rotation;
			Target.Slot = this;
			InSocket = Target;
		} else {
			Rigidbody RBCube = GetComponent<Rigidbody>();
			if(RBCube) RBCube.isKinematic = false;
			Collider RBCol = GetComponent<Collider>();
			if(RBCol) RBCol.isTrigger = false;
		}
	}
}
