using UnityEngine;
using System.Collections;

public class LightFlickerScript : MonoBehaviour {
	
	
	public Light lighty;
	
	
	public float minIntensity = 0.45f;
	public float maxIntensity = 0.55f;
	public float flickerRange = 0.002f;
	
	public float frequency = 0.2f;
	
	private Vector3 startPos;
	
	// Use this for initialization
	void Start () {
		startPos = lighty.transform.localPosition;
	}
	
	// Update is called once per frame
	void Update () {
		if (Random.Range(0f,1f) < frequency){
			lighty.intensity = Random.Range(minIntensity,maxIntensity);
			lighty.transform.localPosition = startPos + new Vector3(Random.Range(-flickerRange,flickerRange),Random.Range(-flickerRange,flickerRange),Random.Range(-flickerRange,flickerRange));
		}
	}
}
