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 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 |
class SensorListNode extends Engine.Actor; // Not replicated, only valid on server! This is used on the server // to match SensorListNodes to the rook they represent. var Rook sensedRook; var class sensedRookClass; var class<TeamInfo> sensedRookTeamClass; var bool relevantLastUpdate; var SensorListNode next; // Not replicated, only valid on server! The client only ever reads // this list from beginning to end, so only needs the next property var SensorListNode prev; enum EHeightDiff { HD_ABOVE, HD_LEVEL, HD_BELOW }; var private EHeightDiff height; var byte xPosition; var byte yPosition; var byte localX; var byte localY; var float xTime; var float yTime; var float lastUpdateTimeX; var float lastUpdateTimeY; var float xPos; var float yPos; var float xOld; var float yOld; var float xNew; var float yNew; replication { reliable if (Role == ROLE_Authority && bNetOwner) relevantLastUpdate, next, sensedRookClass, sensedRookTeamClass, height, xPosition, yPosition; } overloaded function construct(PlayerCharacterController _owner, Rook _sensedRook) { super.construct(_owner); set(_sensedRook); } simulated function Tick(float Delta) { local float mapExtent; if (Level.NetMode == NM_DedicatedServer) return; mapExtent = Level.GetMapTextureExtent(); if (xPosition != localX) { xTime = 0.0; xNew = (float(xPosition) / 255.0) * mapExtent - (mapExtent * 0.5); xNew += Level.GetMapTextureOrigin().X; if (Level.TimeSeconds - lastUpdateTimeX > 2.0) // Snap if we haven't received an update recently xOld = xNew; else xOld = xPos; localX = xPosition; lastUpdateTimeX = Level.TimeSeconds; } if (yPosition != localY) { yTime = 0.0; yNew = (float(yPosition) / 255.0) * mapExtent - (mapExtent * 0.5); yNew += Level.GetMapTextureOrigin().Y; if (Level.TimeSeconds - lastUpdateTimeY > 2.0) // Snap if we haven't received an update recently yOld = yNew; else yOld = yPos; localY = yPosition; lastUpdateTimeY = Level.TimeSeconds; } if (xTime < 0.5) { xPos = Lerp(xTime / 0.5, xOld, xNew); xTime += Delta; } if (yTime < 0.5) { yPos = Lerp(yTime / 0.5, yOld, yNew); yTime += Delta; } } function update() { local bool isRelevant; isRelevant = PlayerCharacterController(Owner).isRookRelevant(sensedRook); if (isRelevant || relevantLastUpdate) updateWhenRelevant(); relevantLastUpdate = isRelevant; sensedRook.sensorUpdateFlag = true; } protected function updateWhenRelevant() { local int intHeight; local Vector mapSpaceLocation; local float mapExtent; local float halfMapExtent; intHeight = PlayerCharacterController(Owner).calculateHeight(sensedRook.Location.Z); if (intHeight == 1) height = HD_ABOVE; else if (intHeight == -1) height = HD_BELOW; else height = HD_LEVEL; mapSpaceLocation = sensedRook.Location - Level.GetMapTextureOrigin(); mapExtent = Level.GetMapTextureExtent(); halfMapExtent = mapExtent * 0.5; xPosition = byte(((mapSpaceLocation.X + halfMapExtent) / mapExtent) * 255.0 + 0.5); yPosition = byte(((mapSpaceLocation.Y + halfMapExtent) / mapExtent) * 255.0 + 0.5); } function set(Rook newRook) { sensedRook = newRook; sensedRookClass = sensedRook.GetRadarInfoClass(); sensedRookTeamClass = sensedRook.team().class; updateWhenRelevant(); } function detachNode() { if (prev != None) prev.next = next; if (next != None) next.prev = prev; } simulated function int getHeight() { if (height == HD_ABOVE) return 1; else if (height == HD_BELOW) return -1; return 0; } simulated function float getXPosition() { return xPos; } simulated function float getYPosition() { return yPos; } defaultproperties { RemoteRole = ROLE_SimulatedProxy bOnlyRelevantToOwner = true bReplicateMovement = false bHidden = true } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |