using UnityEngine;
using System.Collections;

public class BottleManager : MonoBehaviour 
{
	// Update is called once per frame
	void Update () 
	{
		transform.Rotate(new Vector3(1000,0,0)*Time.deltaTime);   //Rotation de la bouteille
		Destroy(gameObject,5);
		
		if(GameManager.loose || GameManager.betweenLevel || GameManager.gameOver && GameManager.win)
		{
			Destroy(gameObject);
		}
	}
	
	void OnTriggerEnter(Collider ObjetInfo)
	{
		if(ObjetInfo.gameObject.tag == "ennemyBottle")		//Si notre bouteille touche la bouteille ennemi
		{	
			Destroy(gameObject);
			Destroy(ObjetInfo.gameObject);
			GameManager.ammunition +=5;						//on gagne 5 bouteilles
			GameManager.score += 10;						//on gagne 10 points
		}
	}
}
