9 static const float PARTICLE_IMPULSE_DEFAULT = 0.5;
10 static const float PARTICLE_IMPULSE_INCENDIARY = 1;
11 static const float PARTICLE_IMPULSE_EXPLOSION = 1;
12 static const float PARTICLE_IMPULSE_COLLISION = 0.5;
18 float impulseScale = PARTICLE_IMPULSE_DEFAULT;
24 impulseScale = PARTICLE_IMPULSE_INCENDIARY;
29 impulseScale = PARTICLE_IMPULSE_EXPLOSION;
34 impulseScale = PARTICLE_IMPULSE_COLLISION;
44 static ParticleEffectEntity PlayParticleEffect_FractionDestruction(IEntity entity, ResourceName particlePath,
EDamageType type, vector hitPos, vector hitDir)
49 if (particlePath == ResourceName.Empty)
52 vector fw = hitDir * 0.5 + entity.GetWorldTransformAxis(2);
54 vector rt = vector.Up * fw;
59 ParticleEffectEntitySpawnParams spawnParams();
60 spawnParams.Transform[0] = rt;
61 spawnParams.Transform[1] = up;
62 spawnParams.Transform[2] = fw;
63 spawnParams.Transform[3] = hitPos;
64 spawnParams.UseFrameEvent =
true;
66 ParticleEffectEntity ptc = ParticleEffectEntity.SpawnParticleEffect(particlePath, spawnParams);
70 float velocityScale = GetPTCImpulseScale(
type);
71 Particles particles = ptc.GetParticles();
72 particles.MultParam(-1, EmitterParam.VELOCITY, velocityScale);
73 particles.MultParam(-1, EmitterParam.VELOCITY_RND, velocityScale);
80 static ParticleEffectEntity PlayParticleEffect_CompleteDestruction(IEntity entity, ResourceName particlePath,
EDamageType damageType,
bool atBoundBoxCenter =
true)
85 if (particlePath == ResourceName.Empty)
88 ParticleEffectEntitySpawnParams spawnParams();
89 spawnParams.TransformMode = ETransformMode.WORLD;
90 entity.GetWorldTransform(spawnParams.Transform);
91 spawnParams.UseFrameEvent =
true;
96 entity.GetBounds(mins, maxs);
97 vector center = (maxs - mins) * 0.5 + mins;
98 spawnParams.Transform[3] = center.Multiply4(spawnParams.Transform);
101 ParticleEffectEntity ptc = ParticleEffectEntity.SpawnParticleEffect(particlePath, spawnParams);
105 float velocityScale = GetPTCImpulseScale(damageType);
106 Particles particles = ptc.GetParticles();
107 particles.MultParam(-1, EmitterParam.VELOCITY, velocityScale);
108 particles.MultParam(-1, EmitterParam.VELOCITY_RND, velocityScale);
115 static ParticleEffectEntity PlayParticleEffect_Child(ResourceName particlePath,
EDamageType damageType, notnull IEntity parent, vector mat[4])
117 if (particlePath == ResourceName.Empty)
120 vector parentTransform[4];
121 parent.GetWorldTransform(parentTransform);
123 ParticleEffectEntitySpawnParams spawnParams();
124 Math3D.MatrixInvMultiply4(parentTransform, mat, spawnParams.Transform);
125 spawnParams.Parent = parent;
126 spawnParams.UseFrameEvent =
true;
128 ParticleEffectEntity ptc = ParticleEffectEntity.SpawnParticleEffect(particlePath, spawnParams);
132 float velocityScale = GetPTCImpulseScale(damageType);
133 Particles particles = ptc.GetParticles();
134 particles.MultParam(-1, EmitterParam.VELOCITY, velocityScale);
135 particles.MultParam(-1, EmitterParam.VELOCITY_RND, velocityScale);
142 static ParticleEffectEntity PlayParticleEffect_Transform(ResourceName particlePath,
EDamageType damageType, vector mat[4])
144 if (particlePath == ResourceName.Empty)
147 ParticleEffectEntitySpawnParams spawnParams();
148 spawnParams.Transform = mat;
149 spawnParams.UseFrameEvent =
true;
151 ParticleEffectEntity ptc = ParticleEffectEntity.SpawnParticleEffect(particlePath, spawnParams);
155 float velocityScale = GetPTCImpulseScale(damageType);
156 Particles particles = ptc.GetParticles();
159 particles.MultParam(-1, EmitterParam.VELOCITY, velocityScale);
160 particles.MultParam(-1, EmitterParam.VELOCITY_RND, velocityScale);