mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-07-04 15:27:19 +07:00
Merge remote-tracking branch 'origin/7.0-features' into 7.0-features
This commit is contained in:
@ -138,8 +138,12 @@ public class Effect{
|
|||||||
create(x, y, rotation, Color.white, data);
|
create(x, y, rotation, Color.white, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void create(float x, float y, float rotation, Color color, Object data){
|
public boolean shouldCreate(){
|
||||||
if(headless || this == Fx.none || !Vars.renderer.enableEffects) return;
|
return !headless && this != Fx.none && Vars.renderer.enableEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create(float x, float y, float rotation, Color color, Object data){
|
||||||
|
if(!shouldCreate()) return;
|
||||||
|
|
||||||
if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(x, y, clip))){
|
if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(x, y, clip))){
|
||||||
if(!initialized){
|
if(!initialized){
|
||||||
@ -150,7 +154,7 @@ public class Effect{
|
|||||||
if(startDelay <= 0f){
|
if(startDelay <= 0f){
|
||||||
add(x, y, rotation, color, data);
|
add(x, y, rotation, color, data);
|
||||||
}else{
|
}else{
|
||||||
Time.runTask(startDelay, () -> add(x, y, rotation, color, data));
|
Time.run(startDelay, () -> add(x, y, rotation, color, data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package mindustry.entities.effect;
|
package mindustry.entities.effect;
|
||||||
|
|
||||||
|
import arc.graphics.*;
|
||||||
import mindustry.entities.*;
|
import mindustry.entities.*;
|
||||||
|
|
||||||
/** Renders multiple particle effects at once. */
|
/** Renders multiple particle effects at once. */
|
||||||
@ -7,33 +8,18 @@ public class MultiEffect extends Effect{
|
|||||||
public Effect[] effects = {};
|
public Effect[] effects = {};
|
||||||
|
|
||||||
public MultiEffect(){
|
public MultiEffect(){
|
||||||
clip = 100f;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MultiEffect(Effect... effects){
|
public MultiEffect(Effect... effects){
|
||||||
this();
|
|
||||||
this.effects = effects;
|
this.effects = effects;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init(){
|
public void create(float x, float y, float rotation, Color color, Object data){
|
||||||
for(Effect f : effects){
|
if(!shouldCreate()) return;
|
||||||
f.init();
|
|
||||||
clip = Math.max(clip, f.clip);
|
|
||||||
lifetime = Math.max(lifetime, f.lifetime);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
for(var effect : effects){
|
||||||
public void render(EffectContainer e){
|
effect.create(x, y, rotation, color, data);
|
||||||
int index = 0;
|
|
||||||
for(Effect f : effects){
|
|
||||||
int i = ++index;
|
|
||||||
e.scaled(f.lifetime, cont -> {
|
|
||||||
cont.id = e.id + i;
|
|
||||||
f.render(cont);
|
|
||||||
});
|
|
||||||
clip = Math.max(clip, f.clip);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user