Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

# Gameplay.TriggerRadius

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
00105

    class TriggerRadius extends Trigger
    	placeable;

    var() int maxEnterCount;
    var() int maxExitCount;
    var() bool doLOSCheck;

    var int enterCount;
    var int exitCount;

    // Touch
    function Touch(Actor Other)
    {
    	local int i;
    	local Rook r;

    	r = Rook(Other);

    	if (r != None && !r.isAlive())
    		return;

    	if (IsOverlapping(Other))
    	{
    		if (checkLOS(Other))
    		{
    			dispatchEnter(Other);
    		}
    	}
    	else // Not overlapping so remove each from touching lists
    	{
    		for (i = 0; i < Touching.Length; ++i)
    		{
    			if (Touching[i] == Other)
    			{
    				Touching.Remove(i, 1);
    				break;
    			}
    		}

    		for (i = 0; i < Other.Touching.Length; ++i)
    		{
    			if (Other.Touching[i] == Self)
    			{
    				Other.Touching.Remove(i, 1);
    				break;
    			}
    		}
    	}
    }

    // UnTouch
    function UnTouch(Actor Other)
    {
    	if (checkLOS(Other))
    	{
    		dispatchExit(Other);
    	}
    }

    function bool checkLOS(Actor triggerer)
    {
    	local Vector hitLocation;
    	local Vector hitNormal;

        return !doLOSCheck || triggerer == Trace(hitLocation, hitNormal, triggerer.Location);
    }

    // dispatchEnter
    private function bool dispatchEnter(Actor instigator)
    {
    	if (!canTrigger(instigator))
    		return false;

    	if (maxEnterCount > -1 && enterCount >= maxEnterCount)
    		return false;

    	SLog("Trigger " $ Label $ " entered by " $ instigator.Label);

    	enterCount++;
    	return dispatchTrigger(instigator, new class'MessageTriggerEnter'(label, instigator.label));
    }

    // dispatchExit
    private function bool dispatchExit(Actor instigator)
    {
    	if (!canTrigger(instigator, true))
    		return false;

    	if (maxExitCount > -1 && exitCount >= maxExitCount)
    		return false;

    	SLog("Trigger " $ Label $ " exited by " $ instigator.Label);

    	exitCount++;
    	return dispatchTrigger(instigator, new class'MessageTriggerExit'(label, instigator.label));
    }

    defaultproperties
    {
    	bOnlyAffectPawns = true
        CollisionRadius=+00040.000000
        CollisionHeight=+00040.000000
    	maxEnterCount = -1
    	maxExitCount = -1
    }

Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation
previous class next class | frames no frames

Class file time: ne 5.9.2004 15:53:28.000 - Creation time: st 23.5.2018 00:10:49.162 - Created with UnCodeX