Prevent server sound ear destruction / Particle effect rand param
This commit is contained in:
@@ -4,14 +4,19 @@ import arc.*;
|
||||
import arc.graphics.*;
|
||||
import arc.graphics.g2d.*;
|
||||
import arc.math.*;
|
||||
import arc.math.geom.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.*;
|
||||
import mindustry.graphics.*;
|
||||
|
||||
/** The most essential effect class. Can create particles in various shapes. */
|
||||
public class ParticleEffect extends Effect{
|
||||
private static final Rand rand = new Rand();
|
||||
private static final Vec2 rv = new Vec2();
|
||||
|
||||
public Color colorFrom = Color.white.cpy(), colorTo = Color.white.cpy();
|
||||
public int particles = 6;
|
||||
public boolean randLength = true;
|
||||
public float cone = 180f, length = 20f, baseLength = 0f;
|
||||
/** Particle size/length/radius interpolation. */
|
||||
public Interp interp = Interp.linear;
|
||||
@@ -57,15 +62,25 @@ public class ParticleEffect extends Effect{
|
||||
Lines.stroke(interp.apply(strokeFrom, strokeTo, rawfin));
|
||||
float len = interp.apply(lenFrom, lenTo, rawfin);
|
||||
|
||||
Angles.randLenVectors(e.id, particles, length * fin + baseLength, e.rotation, cone, (x, y) -> {
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < particles; i++){
|
||||
float l = length * fin + baseLength;
|
||||
rv.trns(e.rotation + rand.range(cone), !randLength ? l : rand.random(l));
|
||||
float x = rv.x, y = rv.y;
|
||||
|
||||
Lines.lineAngle(ox + x, oy + y, Mathf.angle(x, y), len);
|
||||
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity* Draw.getColor().a);
|
||||
});
|
||||
Drawf.light(ox + x, oy + y, len * lightScl, lightColor, lightOpacity * Draw.getColor().a);
|
||||
}
|
||||
}else{
|
||||
Angles.randLenVectors(e.id, particles, length * fin + baseLength, e.rotation, cone, (x, y) -> {
|
||||
rand.setSeed(e.id);
|
||||
for(int i = 0; i < particles; i++){
|
||||
float l = length * fin + baseLength;
|
||||
rv.trns(e.rotation + rand.range(cone), !randLength ? l : rand.random(l));
|
||||
float x = rv.x, y = rv.y;
|
||||
|
||||
Draw.rect(tex, ox + x, oy + y, rad, rad, e.rotation + offset + e.time * spin);
|
||||
Drawf.light(ox + x, oy + y, rad * lightScl, lightColor, lightOpacity * Draw.getColor().a);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user