- Home /
Player Blink Timer
I am trying to make a game where you have a blink timer. So around every 10-15 seconds you blink (All lights shut off for a second). I don't even know where to start on this script, so could someone give me a hand?
Answer by Myhijim · Jul 05, 2012 at 02:20 PM
Timer
Try using a yield Waitforseconds for the waiting part.
Eg.
yield WaitForSecconds(10)
{
//Do code
}
Source: http://docs.unity3d.com/Documentation/ScriptReference/WaitForSeconds.html
Turning Off Lights
For the blinking part you could assign the script to all lights so they are synchronised.
To turn the lights off try have a sticky beak at the script reference .
GetComponent(Light).enabled = false;
Source : http://docs.unity3d.com/Documentation/ScriptReference/Behaviour-enabled.html?from=Light
In conclusion
Try to incorporate the code
yield WaitForSeconds(10)
GetComponent(Light).enabled = false;
Alternative
Disable the camera instead of the lights all at once, (Probably the better choice), i will leave this and the knowledge from above up to you
~ Myhijim
Your answer
Follow this Question
Related Questions
Start/Stop Timer when player enters/exits a specific space? 1 Answer
How to make blinking eyes effect like in scp:cb? 0 Answers
Lighting only happening when the player get close. 4 Answers
Display countdown timer in Unity: distance traveled C# 1 Answer
How would you make your player freeze for a certain amount of time? 2 Answers