Core.Object | +--Engine.Actor | +--Engine.Triggers | +--UnrealI.ElevatorTrigger
class
ClassProximityType
enum
ETriggerType
int
GotoKeyframe
float
MoveTime
bool
bTriggerOnceOnly
IsRelevant(Actor Other)
// // See whether the other actor is relevant to this trigger. //
void
Touch(Actor Other)
// // Called when something touches the trigger. //
00001 //============================================================================= 00002 // ElevatorTrigger. 00003 //============================================================================= 00004 class ElevatorTrigger extends Triggers; 00005 00006 // A special trigger devised for the ElevatorMover class, since 00007 // detecting one trigger message is not enough to determine 2 or more 00008 // different commands (like up/down). When an actor is within its' 00009 // radius, it sends a message to the ElevatorMover with the desired 00010 // keyframe change and moving time interval. 00011 00012 var() int GotoKeyframe; 00013 var() float MoveTime; 00014 var() bool bTriggerOnceOnly; 00015 var() class<actor> ClassProximityType; 00016 00017 // Trigger type. 00018 var() enum ETriggerType 00019 { 00020 TT_PlayerProximity, // Trigger is activated by player proximity. 00021 TT_PawnProximity, // Trigger is activated by any pawn's proximity 00022 TT_ClassProximity, // Trigger is activated by actor of that class only 00023 TT_AnyProximity, // Trigger is activated by any actor in proximity. 00024 TT_Shoot, // Trigger is activated by player shooting it. 00025 } TriggerType; 00026 00027 // 00028 // See whether the other actor is relevant to this trigger. 00029 // 00030 final function bool IsRelevant( actor Other ) 00031 { 00032 switch( TriggerType ) 00033 { 00034 case TT_PlayerProximity: 00035 return Pawn(Other)!=None && Pawn(Other).bIsPlayer; 00036 case TT_PawnProximity: 00037 return Pawn(Other)!=None && ( Pawn(Other).Intelligence > BRAINS_None ); 00038 case TT_ClassProximity: 00039 return ClassIsChildOf(Other.Class, ClassProximityType); 00040 case TT_AnyProximity: 00041 return true; 00042 case TT_Shoot: 00043 return ( Projectile(Other) != None ); 00044 } 00045 } 00046 // 00047 // Called when something touches the trigger. 00048 // 00049 function Touch( actor Other ) 00050 { 00051 local ElevatorMover EM; 00052 if( IsRelevant( Other ) ) 00053 { 00054 // Call the ElevatorMover's Move function 00055 if( Event != '' ) 00056 foreach AllActors( class 'ElevatorMover', EM, Event ) 00057 EM.MoveKeyframe( GotoKeyFrame, MoveTime ); 00058 00059 if( bTriggerOnceOnly ) 00060 // Ignore future touches. 00061 SetCollision(False); 00062 } 00063 } 00064 00065 defaultproperties 00066 { 00067 }