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

UnrealI.FatnessTrigger


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
//=============================================================================
// FatnessTrigger
// When triggered, alters the fatness of an actor from one state to another,
// over a set time interval.
//=============================================================================
class FatnessTrigger extends Triggers;

var() Name  FatTag;     // Tag of object to recieve Fattening/UnFattening
var() int   StartFatness;   // The initial fatness of the object
var() int   EndFatness;     // The final fatness of the object
var() float ChangeTime;     // How long does the change take?

var Actor FatActor;
var float TimePassed;

function BeginPlay()
{
    FatActor = None;
    TimePassed = 0;
}

function Trigger( Actor Other, Pawn EventInstigator )
{
    // Find the object that should be changed
    if ( FatTag != '' )
        foreach AllActors( class 'Actor', FatActor, FatTag )
        {
        }

    if( FatActor != None )
    {
        Enable('Tick');
    }
}

function Tick( float DeltaTime )
{
    local float CurFat, TimeRatio;

    if( FatActor != None )
    {
        // Check the timing
        TimePassed += DeltaTime;
        if( TimePassed >= ChangeTime )
        {
            TimeRatio = 1;
            Disable('Tick');
        }
        else TimeRatio = TimePassed/ChangeTime;

        // Continue the fattening process
        CurFat = (Float(EndFatness) - Float(StartFatness))*TimeRatio + Float(StartFatness);
        FatActor.fatness = Int( CurFat );
    }
    else Disable('Tick');
}

defaultproperties
{
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Do 19.5.2005 19:42:14.000 - Creation time: Fr 7.6.2013 13:15:41.170 - Created with UnCodeX