Overview | Package | Class | Source | Class tree | Glossary | 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 |
//================================================= // BEResettableCounter - Slinky - 4/28/05 //================================================= // Just like Counter, but resets itself when // untriggered. //================================================= // Black Ether Studios, 2005. //================================================= class BEResettableCounter extends Counter; var () int CountDownInterval; // time between each decrement of the counter when it is in state_TimedCountDown var () string TimeUpMessage; var bool bCounting; // True when counter is counting down. False when it has been halted, via another trigger call. event Untrigger( Actor Other, Pawn EventInstigator ) { Reset(); } // Counter was triggered. // Other trigger turns this on. function Trigger( actor Other, pawn EventInstigator ) { local string S; local string Num; if( NumToCount > 0 ) { if( --NumToCount == 0 ) { // Trigger all matching actors. if( bShowMessage && (CompleteMessage != "")) Level.Game.Broadcast(Self,CompleteMessage,'CriticalEvent'); TriggerEvent(Event,Other,EventInstigator); } else if( bShowMessage && CountMessage != "" ) { // Still counting down. switch( NumToCount ) { case 1: Num="one"; break; case 2: Num="two"; break; case 3: Num="three"; break; case 4: Num="four"; break; case 5: Num="five"; break; case 6: Num="six"; break; default: Num=string(NumToCount); break; } S = CountMessage; ReplaceText(S,"%i",Num); Level.Game.Broadcast(Self,S,'CriticalEvent'); } } } function Timer() { if (!bCounting) return; NumToCount --; // Counter made it to zero. we failed. if(NumToCount <= 0) { if( TimeUpMessage!="" ) Level.Game.Broadcast(Self,TimeUpMessage,'CriticalEvent'); TriggerEvent(Event,self,Instigator); SetTimer(0,false); bCounting = false; } else Level.Game.Broadcast(Self,"00:"$NumToCount,'CriticalEvent'); } // Other trigger turns this on. state() TimedCountDown { function Trigger( actor Other, pawn EventInstigator ) { Instigator = EventInstigator; // If we ARE counting down, start the timer. Otherwise, we've been asked to halt. Let the timer know, so it can // stop itself in the next iteration. if (!bCounting) { SetTimer(CountDownInterval,true); bCounting = true; } else if(bCounting) { bCounting = false; SetTimer(0,false); } } } defaultproperties { CountDownInterval=1 TimeUpMessage="TIME UP" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |