You will likely need to use floats and the time functions in Unity to accomplish this.
Something like this pseudocode solution should probably work. Replace "theTimerShouldBeGoingUp" with whatever condition you want to check and timeVariable with a float you declare to keep track of time.
void Update()
{
if(theTimerShouldBeGoingUp==true)
{
timeVariable += Time.deltaTime;
if(timeVariable>=4.0f)
{
//Missile lock on code goes here
}
}else{
timeVariable=0;
}
}
↧