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

public class FadeLight : MonoBehaviour {

	public Light light;
	public bool small,medium,large;
	public float lightSize,smaLight, medLight,larLight;
	public float fade;
	// Use this for initialization
	void Awake () 
	{
		smaLight = 15;
		medLight = 35;
		larLight = 55;
		this.transform.Rotate (new Vector3(90,0,0));
		light = this.GetComponent<Light>();
		if(small)
		{
			lightSize = smaLight;
			fade = 8f;

		}
		if(medium)
		{
			lightSize = medLight;
			fade = 19;

		}
		if(large)
		{
			lightSize = larLight;
			fade = 30;
		}
		light.spotAngle = lightSize;
	}
	
	// Update is called once per frame
	void Update () 
	{
		if(light.spotAngle > 1)
		{
			light.spotAngle -= Time.deltaTime *fade;
		}
		if(light.spotAngle <=1)
		{
			Destroy(this.gameObject);
		}
	}
}
