Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
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 |
/* -------------------------------------------------------------- KF_Objective_EventListener -------------------------------------------------------------- Bzsic Proxy actor which receives trigger events for Objective conditions. As of 10/17/13 we are also using this to store actor references for conditions. Author : Alex Quick -------------------------------------------------------------- */ class KF_Objective_EventListener extends Actor; // Condition which this actor stores actor References for. var private KF_ObjectiveCondition ConditionOwner; // A struct which contains a reference to an actor. // Objects cannot have references to actors which are being garbage collected // or the game will crash. So we cache them here instead. struct SConditionActorReference { var Actor TargetActor; var name ActorName; }; // This array contains a list of all the Actors which are relevant to its ConditionOwner. var protected array<SConditionActorReference> AssociatedActors; // This function is called to cache an Actor that is relevant to ConditionOwner. function AddAssociatedActor(name NewActorName,Actor NewActor ) { local int Index; if(!FindAssociatedActor(NewActorName,,Index)) { AssociatedActors.Length = AssociatedActors.length + 1; AssociatedActors[AssociatedActors.length - 1].TargetActor = NewActor; AssociatedActors[AssociatedActors.length - 1].ActorName = NewActorName; } else { AssociatedActors[Index].TargetActor = NewActor; } } // This function is called to remove an Actor associated with ConditionOwner from the AssociatedActors cache. function RemoveAssociatedActor(name ActorToRemove) { local int Index; if(FindAssociatedActor(ActorToRemove,,Index)) { AssociatedActors.Remove(Index,1); } } // Search the AssociatedActors cache by name. function bool FindAssociatedActor( name TargetActorName, optional out Actor TargetActor , optional out int Index) { local int i; for(i = 0 ; i < AssociatedActors.length ; i ++) { if(AssociatedActors[i].ActorName != '' && AssociatedActors[i].ActorName == TargetActorName) { TargetActor = AssociatedActors[i].TargetActor; Index = i; return true; } } return false; } function SetConditionOwner(KF_ObjectiveCondition NewOwner) { ConditionOwner = NewOwner; Tag = ConditionOwner.Tag; } function KF_ObjectiveCondition GetConditionOwner() { return ConditionOwner; } function Trigger( actor Other, pawn EventInstigator ) { if(ConditionOwner != none) { ConditionOwner.Trigger(Other,EventInstigator); } } defaultproperties { bHidden=True RemoteRole=ROLE_None } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |