Overview | Package | Class | Source | Class tree | Glossary | Deus Ex UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 |
//============================================================================= // Timer. //============================================================================= class Timer expands Keypoint; var() bool bCountDown; // count down? var() float startTime; // what time do we start from? var() float criticalTime; // when does the text turn red? var() float destroyDelay; // after timer has expired, how long until we destroy the window var() string message; // message to print on timer window var TimerDisplay timerWin; var float time; var bool bDone; // // count up or down depending on what the settings are // event Tick(float deltaTime) { if (timerWin != None) { if (bDone) { timerWin.bFlash = True; return; } if (bCountDown) { time -= deltaTime; if (time < 0) time = 0; if (time <= criticalTime) timerWin.bCritical = True; } else { time += deltaTime; if (time >= criticalTime) timerWin.bCritical = True; } timerWin.time = time; } } // // destroy the window // function Timer() { timerWin.Destroy(); } // // start or stop the timer // function Trigger(Actor Other, Pawn EventInstigator) { local DeusExPlayer player; player = DeusExPlayer(EventInstigator); if (player == None) return; Super.Trigger(Other, EventInstigator); if (timerWin == None) { if (bCountDown) time = startTime; else time = 0; timerWin = DeusExRootWindow(player.rootWindow).hud.CreateTimerWindow(); timerWin.time = time; timerWin.bCritical = False; timerWin.message = message; bDone = False; PlaySound(sound'Beep3', SLOT_Misc); player.ClientMessage("Timer started"); } else if (!bDone && (timerWin != None)) { bDone = True; SetTimer(destroyDelay, False); PlaySound(sound'Beep3', SLOT_Misc); player.ClientMessage("Timer stopped"); } } defaultproperties { bCountDown=True StartTime=60.000000 criticalTime=10.000000 destroyDelay=5.000000 Message="Countdown" bStatic=False } |
Overview | Package | Class | Source | Class tree | Glossary | Deus Ex UnrealScript Documentation |
previous class next class | frames no frames |