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 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. */ class UTOnslaughtTarydiumProcessor extends UTOnslaughtNodeEnhancement abstract; var() UTOnslaughtTarydiumMine Mine; var() float OreEventThreshold; var repnotify float OreCount; const MAXMINERS = 4; var UTOnslaughtMiningRobot MiningBots[MAXMINERS]; var class<UTOnslaughtMiningRobot> MiningBotClass; var() SkeletalMeshComponent Mesh; var() StaticMeshComponent StaticMesh; var MaterialInstanceConstant SailMIC; var MaterialInstanceConstant TopMIC; var MaterialInstanceConstant PistonMIC; var vector ProcColor; var vector TargetProcColor; var float ProcColorBlend; var() float BotSpawnDist; replication { if (bNetDirty) OreCount; } simulated function PostBeginPlay() { local UTOnslaughtTarydiumMine M; local float BestDist, NewDist; super.PostBeginPlay(); if ( Mine == None ) { // find closest mine ForEach WorldInfo.AllNavigationPoints(class'UTOnslaughtTarydiumMine', M) { NewDist = VSize(M.Location - Location); if ( (Mine == None) || (NewDist < BestDist) ) { Mine = M; BestDist = NewDist; } } } SailMIC = Mesh.CreateAndSetMaterialInstanceConstant(1); TopMIC = Mesh.CreateAndSetMaterialInstanceConstant(4); PistonMIC = Mesh.CreateAndSetMaterialInstanceConstant(3); } simulated function UpdateTeamEffects() { TargetProcColor = (DefenderTeamIndex%2==0) ? vect(1.0, 0.0, 0.0) : vect(0.0, 0.0, 1.0); ProcColorBlend = 0.0; } simulated function LinearColor VecToLinColor(vector InVec) { local LinearColor OutColor; OutColor.R = InVec.X; OutColor.G = InVec.Y; OutColor.B = InVec.Z; OutColor.A = 1.0; return OutColor; } simulated function Tick(float DeltaSeconds) { local float UseBlend; local vector NewColor; Super.Tick(DeltaSeconds); if( ProcColorBlend < 1.0 ) { ProcColorBlend += (1.0 * DeltaSeconds); if(ProcColorBlend >= 1.0) { ProcColor = TargetProcColor; NewColor = TargetProcColor; } else { UseBlend = FCubicInterp(0.0, 0.0, 1.0, 0.0, ProcColorBlend); NewColor = (UseBlend * (TargetProcColor - ProcColor)) + ProcColor; } PistonMIC.SetVectorParameterValue('Color_Pistons', VecToLinColor(1.5 * NewColor)); TopMIC.SetVectorParameterValue('Color_top', VecToLinColor(11.0 * NewColor)); SailMIC.SetVectorParameterValue('Color', VecToLinColor(22.0 * NewColor)); } } simulated event ReplicatedEvent(name VarName) { if(VarName == 'OreCount') { UpdateAnimRate(); } else { Super.ReplicatedEvent(VarName); } } /** Update rate of animation based on how much ore we have. */ simulated function UpdateAnimRate() { local AnimNodeSequence SeqNode; SeqNode = AnimNodeSequence(Mesh.Animations); SeqNode.Rate = FClamp(OreCount/OreEventThreshold, 0.0, 1.0); } function ReceiveOre(float Quantity) { local int i; local float Count, OreShare; local UTOnslaughtObjective O; local UTOnslaughtGame TheGame; // count received ore for Kismet event OreCount += Quantity; if ( OreCount >= OreEventThreshold ) { OreCount -= OreEventThreshold; TriggerEventClass(class'UTSeqEvent_MinedOre', None); } UpdateAnimRate(); if (ControllingNode != None && ControllingNode.IsActive()) { // count how many team controlled objectives accept tarydium boosts count = 0; TheGame = UTOnslaughtGame(WorldInfo.Game); for ( i=0; i<TheGame.PowerNodes.Length; i++ ) { O = TheGame.PowerNodes[i]; if ( O.IsActive() && WorldInfo.GRI.OnSameTeam(ControllingNode, O) ) { Count += 1; } } // give a boost to each team controlled objective which accepts it OreShare = Quantity/Count; TheGame.PowerCore[ControllingNode.DefenderTeamIndex].ProcessedTarydium += Quantity; for ( i=0; i<TheGame.PowerNodes.Length; i++ ) { TheGame.PowerNodes[i].TarydiumBoost(OreShare); } } } function MinerDestroyed() { CreateMiner(10); } function Activate() { CreateMiner(3); super.Activate(); } function CreateMiner(float MinerCreationTime) { local float CurrentTimer; // if timer is already active, set to lesser of remaining time and new time CurrentTimer = GetTimerRate('SpawnMiner'); if (CurrentTimer > 0.f) { SetTimer(FMin(MinerCreationTime, CurrentTimer - GetTimerCount('SpawnMiner')), false, 'SpawnMiner'); } else { SetTimer(MinerCreationTime, false, 'SpawnMiner'); } } function SpawnMiner() { local int i, Count, Slot; local vector X,Y,Z; Slot = -1; for ( i=0; i<MAXMINERS; i++ ) { if ( (MiningBots[i] != None) && !MiningBots[i].bDeleteMe ) Count++; else if ( Slot == -1 ) Slot = i; } if ( Count == MAXMINERS ) return; GetAxes(Rotation, X,Y,Z); MiningBots[Slot] = spawn(MiningBotClass,,, Location - (BotSpawnDist*Y)); if ( MiningBots[Slot] != None && !MiningBots[Slot].bDeleteMe ) { MiningBots[Slot].Home = self; MiningBots[Slot].ControllingNode = ControllingNode; Count++; } if ( Count < MAXMINERS ) { SetTimer(5, false, 'SpawnMiner'); } } function Deactivate() { local int i; for ( i=0; i<MAXMINERS; i++ ) { if ( (MiningBots[i] != None) && !MiningBots[i].bDeleteMe ) MiningBots[i].Destroy(); } ClearTimer('SpawnMiner'); Super.Deactivate(); } defaultproperties { BotSpawnDist=300.000000 Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTOnslaughtNodeEnhancement:CollisionCylinder' ObjectArchetype=CylinderComponent'UTGame.Default__UTOnslaughtNodeEnhancement:CollisionCylinder' End Object CylinderComponent=CollisionCylinder Begin Object Class=SpriteComponent Name=Sprite ObjName=Sprite Archetype=SpriteComponent'UTGame.Default__UTOnslaughtNodeEnhancement:Sprite' ObjectArchetype=SpriteComponent'UTGame.Default__UTOnslaughtNodeEnhancement:Sprite' End Object GoodSprite=Sprite Begin Object Class=SpriteComponent Name=Sprite2 ObjName=Sprite2 Archetype=SpriteComponent'UTGame.Default__UTOnslaughtNodeEnhancement:Sprite2' ObjectArchetype=SpriteComponent'UTGame.Default__UTOnslaughtNodeEnhancement:Sprite2' End Object BadSprite=Sprite2 Components(0)=Sprite Components(1)=Sprite2 Begin Object Class=ArrowComponent Name=Arrow ObjName=Arrow Archetype=ArrowComponent'UTGame.Default__UTOnslaughtNodeEnhancement:Arrow' ObjectArchetype=ArrowComponent'UTGame.Default__UTOnslaughtNodeEnhancement:Arrow' End Object Components(2)=Arrow Components(3)=CollisionCylinder Begin Object Class=PathRenderingComponent Name=PathRenderer ObjName=PathRenderer Archetype=PathRenderingComponent'UTGame.Default__UTOnslaughtNodeEnhancement:PathRenderer' ObjectArchetype=PathRenderingComponent'UTGame.Default__UTOnslaughtNodeEnhancement:PathRenderer' End Object Components(4)=PathRenderer CollisionComponent=CollisionCylinder Name="Default__UTOnslaughtTarydiumProcessor" ObjectArchetype=UTOnslaughtNodeEnhancement'UTGame.Default__UTOnslaughtNodeEnhancement' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |