Cleaned up weather class

This commit is contained in:
Anuken
2020-03-11 10:08:27 -04:00
parent 930c342fb6
commit 06e94b1800
11 changed files with 58 additions and 13 deletions

View File

@@ -10,6 +10,12 @@ public class Weathers implements ContentList{
@Override
public void load(){
snow = new Weather("snow"){
@Override
public void draw(){
//TODO
}
};
}
}

View File

@@ -30,6 +30,11 @@ import static mindustry.Vars.*;
public class Logic implements ApplicationListener{
public Logic(){
Events.on(WorldLoadEvent.class, event -> {
//TODO remove later
Weathers.snow.create();
});
Events.on(WaveEvent.class, event -> {
if(state.isCampaign()){
//TODO implement

View File

@@ -39,7 +39,7 @@ public class Renderer implements ApplicationListener{
camera = new Camera();
Shaders.init();
fx.addEffect(new SnowFilter());
//fx.addEffect(new SnowFilter());
}
public void shake(float intensity, float duration){
@@ -253,6 +253,8 @@ public class Renderer implements ApplicationListener{
overlays.drawTop();
Groups.drawWeather();
endFx();
if(!pixelator.enabled()){

View File

@@ -1,28 +1,59 @@
package mindustry.type;
import arc.func.*;
import mindustry.annotations.Annotations.*;
import mindustry.ctype.*;
import mindustry.gen.*;
public abstract class Weather extends MappableContent{
protected float duration = 100f;
protected Prov<Weatherc> type = WeatherEntity::create;
public Weather(String name, Prov<Weatherc> type){
super(name);
this.type = type;
}
public Weather(String name){
super(name);
}
public abstract void update();
public void create(){
Weatherc entity = type.get();
entity.init(this);
entity.add();
}
public abstract void draw();
public void update(){
}
public void draw(){
}
@Override
public ContentType getContentType(){
return ContentType.weather;
}
//TODO implement
@EntityDef(value = {Weatherc.class}, pooled = true, isFinal = false)
@Component
class WeatherComp{
abstract class WeatherComp implements Posc, DrawLayerWeatherc{
Weather weather;
void init(Weather weather){
this.weather = weather;
}
@Override
public void drawWeather(){
weather.draw();
}
@Override
public float clipSize(){
return Float.MAX_VALUE;
}
}
}