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

Gameplay.KarmaBoostVolume


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
//-----------------------------------------------------------
//
//-----------------------------------------------------------
class KarmaBoostVolume extends PhysicsVolume;

var()   Array< class<Actor> >   AffectedClasses;
var()   float                   EntryAngleFactor; // Actor DOT volume direction must be greater than this
var()   float                   BoostForce;       // Karma force to be applied
var()   bool                    bBoostRelative;   // If true, boost the actor in the direction of the actor instead of the volume direction

simulated event Touch(Actor Other)
{
    local int i;

    Super.Touch(Other);

    if (Other != None)
    {
        for (i=0; i<AffectedClasses.Length; i++)
        {
            if (Other.Class == AffectedClasses[i])
            {
                TryBoost(Other);
                break;
            }
        }
    }
}

simulated event UnTouch(Actor Other)
{
    Super.UnTouch(Other);

    Gravity = Default.Gravity;
}

simulated function TryBoost(Actor Other)
{
    local float EntryAngle;

    EntryAngle = Normal(Other.Velocity) dot Vector(Rotation);

    if (EntryAngle > EntryAngleFactor)
        ActivateBoost(Other);
}

simulated function ActivateBoost(Actor Other)
{
    if (bBoostRelative)
        Gravity = Default.Gravity + (BoostForce * Normal(Other.Velocity));
    else
        Gravity = Default.Gravity + (BoostForce * Vector(Rotation));
}

defaultproperties
{
     EntryAngleFactor=0.700000
     bDirectional=True
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: Tue 24/10/2006 16:57:56.000 - Creation time: Wed 7/2/2007 19:16:42.750 - Created with UnCodeX