Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

Gameplay.Counter


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
//=============================================================================
// Counter: waits until it has been triggered 'NumToCount' times, and then
// it sends Trigger/UnTrigger events to actors whose names match 'EventName'.
//=============================================================================
class Counter extends Triggers;

#exec Texture Import File=Textures\Counter.pcx Name=S_Counter Mips=Off MASKED=1

//-----------------------------------------------------------------------------
// Counter variables.

var() byte       NumToCount;                // Number to count down from.
var() bool       bShowMessage;              // Display count message?
var() localized  string CountMessage;       // Human readable count message.
var() localized  string CompleteMessage;    // Completion message.
var   byte       OriginalNum;               // Number to count at startup time.

//-----------------------------------------------------------------------------
// Counter functions.

//
// Init for play.
//
function BeginPlay()
{
    OriginalNum = NumToCount;
}

/* Reset() 
reset actor to initial state - used when restarting level without reloading.
*/
function Reset()
{
    NumToCount = OriginalNum;
}

//
// Counter was triggered.
//
function Trigger( actor Other, pawn EventInstigator )
{
    local string S;
    local string Num;
    local int i;

    if( NumToCount > 0 )
    {
        if( --NumToCount == 0 )
        {
            // Trigger all matching actors.
            if( bShowMessage && (CompleteMessage != "") && (EventInstigator != None) )
                EventInstigator.ClientMessage( CompleteMessage );
            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;
            while( InStr(S, "%i") >= 0 )
            {
                i = InStr(S, "%i");
                S = Left(S,i) $ Num $ Mid(S,i+2);
            }
            if ( EventInstigator != None )
                EventInstigator.ClientMessage( S );
        }
    }
}

defaultproperties
{
     NumToCount=2
     CountMessage="Only %i more to go..."
     CompleteMessage="Completed!"
     Texture=Texture'Gameplay.S_Counter'
     bCollideActors=Falsch
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Fr 30.3.2007 08:43:38.000 - Creation time: Mo 16.4.2007 11:20:45.875 - Created with UnCodeX