- Home /
Question by
Eldh · Nov 15, 2012 at 09:45 AM ·
timetimertimescaleprogressbar
How to to do a progress bar wich scale down in 6 seconds ? (timeScale used)
So for exemple i want to do a timer wich count down 6 to 0 in seconds. At 6 the progress bar is full at 0 it is empty. In the meantime i use timeScale to slow down the time but i still want the timer counting down real 6 seconds.
private float timerPercent = 1f;
private float timer = 6;
public Texture2D barTimer;
void OnTriggerEnter()
{
Time.timeScale = 0.1f;
}
void OnGUI()
{
if (patternActivate)
{
GUI.BeginGroup(new Rect(Screen.width / 2-200, Screen.height / 2+25, 400 * timerPercent, 10));
GUI.DrawTexture(new Rect(0, 0, 400, 10), barTimer);
GUI.EndGroup();
}
}
void Update()
{
timer = ?
timerPercent = ?
}
Comment