x


how to pause time when hit an object

hi everyone how to i pause time for a few seconds when i hit an object? i have a timer script:

function Awake() {

startTime = Time.time;

}

function OnGUI () {

GUI.skin = guiSkin; //make sure that your time is based on when this script was first called //instead of when your game started var guiTime = Time.time - startTime;

restSeconds = countDownSeconds - (guiTime);

//display messages or whatever here -->do stuff based on your timer
if (restSeconds == 60) {
    print ("One Minute Left");  
}
if (restSeconds == 0) {
    print ("Time is Over");
    restSeconds = 0;
}
//display the timer
roundedRestSeconds = Mathf.CeilToInt(restSeconds);
displaySeconds = roundedRestSeconds % 60;
displayMinutes = roundedRestSeconds / 60; 

text = String.Format ("{0:00}:{1:00}", displayMinutes, displaySeconds); 
GUI.Label (Rect (500, 60, 300, 100), text);

}

i found a pause object script:

function PauseWaitResume (pauseDelay : float) {

Time.timeScale = .0000001;

yield WaitForSeconds(pauseDelay * Time.timeScale);

Time.timeScale = 1.0;

}

more ▼

asked Sep 18 '11 at 09:20 AM

halo gravatar image

halo
1 4 6 6

What's the problem here? What isn't working?

Sep 18 '11 at 09:59 AM syclamoth

the pausing of the time is not working.

Sep 19 '11 at 03:35 AM halo
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5081
x572
x85

asked: Sep 18 '11 at 09:20 AM

Seen: 589 times

Last Updated: Sep 19 '11 at 03:35 AM