#pragma strict
var counter:int;
var newColor:Color;

function fadeOut(){
	while(true){
		yield WaitForSeconds(1);
		if(counter == 0){
			newColor = new Color(1,1,1,1.0f);
			transform.renderer.material.color = newColor;
		}else if(counter == 1){
			//transform.renderer.material.color.a = 0.5;
			newColor = new Color(1,1,1,0.5f);
			transform.renderer.material.color = newColor;
		}else if(counter == 2){
			//transform.renderer.material.color.a = 0.3;
			newColor = new Color(1,1,1,0.3f);
			transform.renderer.material.color = newColor;
		}else{
			//transform.renderer.material.color.a = 0.1;
			newColor = new Color(1,1,1,0.1f);
			transform.renderer.material.color = newColor;
			break;
		}
		counter++;
	}
	Destroy(this.gameObject);
}

function Start () {
	counter = 0;
	yield fadeOut();
}

function Update () {

}