#pragma strict
var ammoBox:Material;
var ammoBoxBullets: Material;
var cController: CrosshairController;
var count:int;

function Start () {
	count = 0;
	ammoBoxBullets.SetTextureScale("ammoBoxBullets",Vector2(2,2));
	cController = GameObject.FindGameObjectWithTag("Crosshair").GetComponent(CrosshairController);

}

function Update () {
	

}

function OnGUI(){
	
}


//what happens when the object starts hitting the other
function OnCollisionEnter2D(otherObject: Collision2D){
	renderer.material = ammoBoxBullets;
	cController.IncreaseBullets(2);
	count++;
		
}

//what happens when the object stop hitting the other object
function OnCollisionExit2D(otherObject: Collision2D){
	if(count >=2){
		Destroy(this.gameObject);
	}
}

