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

public class HandsS : MonoBehaviour {

	public CatcherS catcher;
	public BallS ball;

	void Start () {
		catcher = transform.root.gameObject.GetComponent<CatcherS> ();
	}

	void OnTriggerEnter2D(Collider2D col) {
		if (col.gameObject.tag == "BALL" && ball.thrown && !catcher.catched) {
			catcher.catched = true;
			catcher.catchedColor = col.gameObject.GetComponent<BallS> ().color;
			ball.rb2d.velocity = Vector2.zero;
			ball.rb2d.angularVelocity = 0;
			ball.rb2d.isKinematic = true;
			ball.transform.SetParent (catcher.transform);
		}
	}

}
