Overview | Package | Class | Source | Class tree | Glossary | Deus Ex 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 |
//============================================================================= // ProjectileGenerator. //============================================================================= class ProjectileGenerator extends Effects; var() float Frequency; // what's the chance of spewing an actor every checkTime seconds var() float EjectSpeed; // how fast do the actors get ejected var() class<actor> ProjectileClass; // class to project var() float ProjectileLifeSpan; // how long each projectile lives var() bool bTriggered; // start by triggering? var() float SpewTime; // how long do I spew after I am triggered? var() bool bRandomEject; // random eject velocity vector var() float CheckTime; // how often should I spit out particles? var() sound SpawnSound; // sound to play when spawned var() float SpawnSoundRadius; // radius of sound var() bool bAmbientSound; // play the ambient sound? var() int NumPerSpawn; // number of particles to spawn per puff var() name AttachTag; // attach us to this actor var() bool bSpewUnseen; // spew stuff when players can't see us var() float WaitTime; // amount of time between bursts var() bool bOnlyOnce; // fire projectiles one time only var() bool bInitiallyOn; // if triggered, start on instead of off var bool bSpewing; // am I spewing? var bool bFrozen; // are we out of the player's sight? var float period; var float time; function Trigger(Actor Other, Pawn EventInstigator) { Super.Trigger(Other, EventInstigator); // if we are spewing, turn us off if (bSpewing) { bSpewing = False; period = 0; time = 0; if (bAmbientSound && (AmbientSound != None)) SoundVolume = 0; } else if (!bOnlyOnce) // otherwise, turn us on { bSpewing = True; period = 0; time = 0; if (bAmbientSound && (AmbientSound != None)) SoundVolume = 255; } } simulated function Tick(float deltaTime) { local int i, j; local int count; local actor spawnee; local float speed; local float timeVal; local vector dir; Super.Tick(deltaTime); // If the owner that I'm attached to is dead, kill me if ((attachTag != '') && (Owner == None)) Destroy(); // Update timers time += deltaTime; period += deltaTime; // If we're spewing and it's time to stop, stop if (bSpewing) { if (SpewTime > 0) { if (period >= SpewTime) { period = 0; time = 0; bSpewing = False; } } else period = 0; } // If we're not spewing and it's time to start, start else if (!bOnlyOnce) { if (WaitTime > 0) { if (period >= WaitTime) { period = 0; time = 0; bSpewing = True; } } else period = 0; } // CNN - remove optimizaions to fix strange behavior of PlayerCanSeeMe() /* // Should we freeze the spewage? if (bSpewUnseen) bFrozen = False; else if (PlayerCanSeeMe()) bFrozen = False; else bFrozen = True; */ // Are we spewing? if (!bSpewing || bFrozen) return; // Is it time to start spewing? if (time >= CheckTime) { // How many projectiles must we spew? if (CheckTime > 0) { count = int(time/CheckTime); time = time - count*CheckTime; } else { count = 1; time = 0; } timeVal = time; // Sanity check if (count > 5) count = 5; // If frequency < 1, make spewage random if (FRand() <= frequency) { if (spawnSound != None) PlaySound(spawnSound, SLOT_Misc,,, SpawnSoundRadius); // Spawn an appropriate number of projectiles for (i=0; i<count; i++) // Number of spews for this tick { for (j=0; j<numPerSpawn; j++) // Number of spawns per spew { // Wayyy down upon the spawnee river... spawnee = spawn(ProjectileClass, Owner); if (spawnee != None) { if (bRandomEject) dir = VRand(); else dir = vector(Rotation); speed = EjectSpeed; if (bRandomEject) speed *= FRand(); spawnee.SetRotation(rotator(dir)); spawnee.Velocity = speed*dir; spawnee.Acceleration = dir; spawnee.SetLocation(spawnee.Velocity*timeVal+Location); if (ProjectileLifeSpan > 0) spawnee.LifeSpan = ProjectileLifeSpan; } } timeVal += CheckTime; } } } } function PostBeginPlay() { local Actor A; Super.PostBeginPlay(); if (bTriggered && !bInitiallyOn) bSpewing = False; // Attach us to the actor that was tagged if (attachTag != '') foreach AllActors(class'Actor', A, attachTag) if (A != None) { SetOwner(A); SetBase(A); } } defaultproperties { Frequency=1.000000 ejectSpeed=300.000000 ProjectileClass=Class'DeusEx.Fireball' checkTime=0.250000 SpawnSoundRadius=1024.000000 numPerSpawn=1 bInitiallyOn=True bSpewing=True bHidden=True bDirectional=True DrawType=DT_Sprite Texture=Texture'Engine.S_Inventory' CollisionRadius=40.000000 CollisionHeight=40.000000 } |
Overview | Package | Class | Source | Class tree | Glossary | Deus Ex UnrealScript Documentation |
previous class next class | frames no frames |