#pragma strict

var speed = 10.0f;
var players;

var navicellaWhite : Material;

function Start () {

	players = GameObject.FindGameObjectsWithTag("Player");

}

function Update () {

	for(var player : GameObject in players) {
		if(player != null) {
			if(this.renderer.bounds.Intersects(player.renderer.bounds)) {
				player.GetComponent(Shoot).score -= 20;
				player.GetComponent(Shoot).Shake();
				Destroy(gameObject);
				Instantiate(player.GetComponent(Shoot).explosionParticleSystem, player.transform.position, player.transform.rotation);
			}
		}
	}
	
	//enemies = GameObject.FindGameObjectsWithTag("Nemici");
	
	transform.Translate(Vector3.right * speed);
	
	if(transform.position.z < -200) {
		Destroy(gameObject);
	}
	
}