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 |
/** * Copyright 1998-2007 Epic Games, Inc. All Rights Reserved. */ class UTBreakablePowerCables extends Actor placeable hidecategories(Collision); var() SkeletalMeshComponent Mesh; var() StaticMeshComponent BoxComp; var ParticleSystemComponent SparkComponent0; var ParticleSystemComponent SparkComponent1; var PointLightComponent SparkLight; var AudioComponent SparkNoise; var AnimNodeSequence AnimNode; var ParticleSystem BreakEffect; var bool bBroken; var vector2D ReSparkInterval; var float TimeToRespawn; simulated function PostBeginPlay() { Super.PostBeginPlay(); // If this is on dedicated server, detach all components and basically shut down if(WorldInfo.NetMode == NM_DedicatedServer) { SetCollision(FALSE, FALSE); DetachComponent(Mesh); DetachComponent(BoxComp); DetachComponent(SparkLight); DetachComponent(SparkNoise); BeginState('IgnoreItAll'); } // If not dedicated - attach particle components to ends of cable else { Mesh.AttachComponent(SparkComponent0, 'BoneEndL'); Mesh.AttachComponent(SparkLight, 'BoneEndL'); Mesh.AttachComponent(SparkNoise, 'BoneEndL'); Mesh.AttachComponent(SparkComponent1, 'BoneEndR'); // Cache pointer to AnimNodeSequence AnimNode = AnimNodeSequence(Mesh.Animations); } } /** State used to stop anything from happening on dedicated server. */ state IgnoreItAll { ignores Touch, TakeDamage, Tick; } /** Something has touched the cable - do all the effects and stuff! */ simulated function BreakCable() { local vector BreakPos; local float SparkTime; // Play animation of cable breaking AnimNode.PlayAnim(FALSE, 1.0, 0.0); // Get location in middle of rope BreakPos = Mesh.GetBoneLocation('BoneEndL'); // Play sparky sound SparkNoise.SoundCue = SoundCue'A_Ambient_NonLoops.HiTech.spark_large_LargeRadius_Cue'; SparkNoise.Play(); // Play big spark effect WorldInfo.MyEmitterPool.SpawnEmitter(BreakEffect, BreakPos); // Make emitter on each end of the cable spark SparkComponent0.SetActive(true); SparkComponent1.SetActive(true); SetTimer(0.3, FALSE, 'TurnOffSparkEffects'); // Turn on light, and set timer to turn it off again SparkLight.SetEnabled(TRUE); SetTimer(0.2, FALSE, 'TurnOffSparkLight'); // Set flag to indicate cables are broken bBroken = TRUE; // Start a timer for causing extra sparks from the cables SparkTime = RandRange(ReSparkInterval.X, ReSparkInterval.Y); SetTimer(SparkTime, FALSE, 'SparkCable'); // Start a countdown to resetting the cables. TimeToRespawn = 30.0; SetTimer(1.0, TRUE, 'CheckRespawn'); // Turn off collision now SetCollision(FALSE, FALSE); } /** */ simulated function TurnOffSparkLight() { SparkLight.SetEnabled(FALSE); } /** */ simulated function TurnOffSparkEffects() { SparkComponent0.DeactivateSystem(); SparkComponent1.DeactivateSystem(); } /** */ simulated function SparkCable() { local float SparkTime; SparkComponent0.SetActive(true); SparkComponent1.SetActive(true); SetTimer(0.3, FALSE, 'TurnOffSparkEffects'); SparkNoise.Stop(); SparkNoise.SoundCue = SoundCue'A_Ambient_NonLoops.HiTech.spark_small_Cue'; SparkNoise.Play(); AnimNode.SetAnim( (FRand() < 0.5) ? 'Spark1' : 'Spark2' ); AnimNode.PlayAnim(FALSE, 1.0, 0.0); SparkTime = RandRange(ReSparkInterval.X, ReSparkInterval.Y); SetTimer(SparkTime, FALSE, 'SparkCable'); } /** Used to countdown to respawn. */ simulated event CheckRespawn() { // If destroyed, countdown to respawn. if(bBroken) { TimeToRespawn -= 1.0; if(TimeToRespawn < 0.f && (Mesh.LastRenderTime < WorldInfo.TimeSeconds - 1.0f)) { // Put cable back to start position AnimNode.SetAnim('Break'); AnimNode.SetPosition(0.0, FALSE); // Turn off sparkinf and respawning timers ClearTimer('SparkCable'); ClearTimer('CheckRespawn'); // Turn collision back on SetCollision(TRUE, FALSE); // Reset flag bBroken = FALSE; } } } /** Look for vehicles touching the cable. */ simulated function Touch(Actor Other, PrimitiveComponent OtherComp, vector HitLocation, vector HitNormal) { if(bBroken) { return; } if( Vehicle(Other) != None ) { BreakCable(); } }; defaultproperties { Begin Object Class=SkeletalMeshComponent Name=MySkeletalMeshComponent ObjName=MySkeletalMeshComponent Archetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent' SkeletalMesh=SkeletalMesh'Envy_Level_Effects_2.DM_HeatRay.SK_PowerWire' Begin Object Class=AnimNodeSequence Name=MySeqNode ObjName=MySeqNode Archetype=AnimNodeSequence'Engine.Default__AnimNodeSequence' AnimSeqName="Break" Name="MySeqNode" ObjectArchetype=AnimNodeSequence'Engine.Default__AnimNodeSequence' End Object Animations=AnimNodeSequence'UTGameContent.Default__UTBreakablePowerCables:MySeqNode' AnimSets(0)=AnimSet'Envy_Level_Effects_2.DM_HeatRay.K_PowerWire_Anims' LightEnvironment=DynamicLightEnvironmentComponent'UTGameContent.Default__UTBreakablePowerCables:MyLightEnvironment' bUseAsOccluder=False CastShadow=False Name="MySkeletalMeshComponent" ObjectArchetype=SkeletalMeshComponent'Engine.Default__SkeletalMeshComponent' End Object Mesh=MySkeletalMeshComponent Begin Object Class=StaticMeshComponent Name=MyCollisionComp ObjName=MyCollisionComp Archetype=StaticMeshComponent'Engine.Default__StaticMeshComponent' StaticMesh=StaticMesh'UN_SimpleMeshes.TexPropCube_Dup' HiddenGame=True BlockActors=False BlockRigidBody=False Translation=(X=0.000000,Y=0.000000,Z=244.000000) Scale3D=(X=4.000000,Y=0.050000,Z=0.130000) Name="MyCollisionComp" ObjectArchetype=StaticMeshComponent'Engine.Default__StaticMeshComponent' End Object BoxComp=MyCollisionComp Begin Object Class=ParticleSystemComponent Name=MySparkComponent0 ObjName=MySparkComponent0 Archetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent' Template=ParticleSystem'Envy_Level_Effects_2.DM_HeatRay.P_PowerWire_Sparks_01' bAutoActivate=False Name="MySparkComponent0" ObjectArchetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent' End Object SparkComponent0=MySparkComponent0 Begin Object Class=ParticleSystemComponent Name=MySparkComponent1 ObjName=MySparkComponent1 Archetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent' Template=ParticleSystem'Envy_Level_Effects_2.DM_HeatRay.P_PowerWire_Sparks_01' bAutoActivate=False Name="MySparkComponent1" ObjectArchetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent' End Object SparkComponent1=MySparkComponent1 Begin Object Class=PointLightComponent Name=MySparkLight ObjName=MySparkLight Archetype=PointLightComponent'Engine.Default__PointLightComponent' FalloffExponent=4.000000 Brightness=8.000000 bEnabled=False CastShadows=False Name="MySparkLight" ObjectArchetype=PointLightComponent'Engine.Default__PointLightComponent' End Object SparkLight=MySparkLight Begin Object Class=AudioComponent Name=MySparkNoise ObjName=MySparkNoise Archetype=AudioComponent'Engine.Default__AudioComponent' SoundCue=SoundCue'A_Ambient_NonLoops.HiTech.spark_large_LargeRadius_Cue' VolumeMultiplier=5.000000 Name="MySparkNoise" ObjectArchetype=AudioComponent'Engine.Default__AudioComponent' End Object SparkNoise=MySparkNoise BreakEffect=ParticleSystem'Envy_Level_Effects_2.DM_HeatRay.P_PowerWireBreak_Spark' ReSparkInterval=(X=1.000000,Y=2.000000) Components(0)=MyCollisionComp Components(1)=MySparkNoise Begin Object Class=DynamicLightEnvironmentComponent Name=MyLightEnvironment ObjName=MyLightEnvironment Archetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent' bDynamic=False Name="MyLightEnvironment" ObjectArchetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent' End Object Components(2)=MyLightEnvironment Components(3)=MySkeletalMeshComponent RemoteRole=ROLE_SimulatedProxy bNoDelete=True bCollideActors=True CollisionComponent=MyCollisionComp Name="Default__UTBreakablePowerCables" ObjectArchetype=Actor'Engine.Default__Actor' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |