Cleanup
This commit is contained in:
@@ -141,27 +141,23 @@ public class Effect{
|
||||
}
|
||||
|
||||
public static void create(Effect effect, float x, float y, float rotation, Color color, Object data){
|
||||
if(headless || effect == Fx.none) return;
|
||||
if(Core.settings.getBool("effects")){
|
||||
Rect view = Core.camera.bounds(Tmp.r1);
|
||||
Rect pos = Tmp.r2.setSize(effect.clip).setCenter(x, y);
|
||||
if(headless || effect == Fx.none || !Core.settings.getBool("effects")) return;
|
||||
|
||||
if(view.overlaps(pos)){
|
||||
if(!effect.initialized){
|
||||
effect.initialized = true;
|
||||
effect.init();
|
||||
}
|
||||
|
||||
EffectState entity = EffectState.create();
|
||||
entity.effect = effect;
|
||||
entity.rotation = rotation;
|
||||
entity.data = data;
|
||||
entity.lifetime = effect.lifetime;
|
||||
entity.set(x, y);
|
||||
entity.color.set(color);
|
||||
if(effect.followParent && data instanceof Posc) entity.parent = ((Posc)data);
|
||||
entity.add();
|
||||
if(Core.camera.bounds(Tmp.r1).overlaps(Tmp.r2.setCentered(x, y, effect.clip))){
|
||||
if(!effect.initialized){
|
||||
effect.initialized = true;
|
||||
effect.init();
|
||||
}
|
||||
|
||||
EffectState entity = EffectState.create();
|
||||
entity.effect = effect;
|
||||
entity.rotation = rotation;
|
||||
entity.data = data;
|
||||
entity.lifetime = effect.lifetime;
|
||||
entity.set(x, y);
|
||||
entity.color.set(color);
|
||||
if(effect.followParent && data instanceof Posc p) entity.parent = p;
|
||||
entity.add();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user