var lightToDim : Light;    
var maxTime : float = 44; //30 seconds
 var tt : float = 2 ;
private var mEndTime : float = 0;
private var mStartTime : float = 0;
 
function Awake()
{
  mStartTime = Time.time;
  mEndTime= mStartTime + maxTime;
}
 
 function Start()
 {
 yield WaitForSeconds (18.5);
 tt=4;
 yield WaitForSeconds (28.5);
 tt=6;
 }
 
function Update()
{

  if(tt==4)
    lightToDim.intensity = Mathf.InverseLerp(mStartTime, mEndTime, -1*Time.time);
    if(tt==6)
    {
    lightToDim.intensity=0.5;
    tt=7;
    }
}