Implemented GFX for all status effects

This commit is contained in:
Anuken
2018-04-05 22:25:08 -04:00
parent 7cd96e379e
commit 343a94bf05
15 changed files with 156 additions and 47 deletions
@@ -1,9 +1,12 @@
package io.anuke.mindustry.content;
import io.anuke.mindustry.content.fx.EnvironmentFx;
import io.anuke.mindustry.entities.StatusController.TransitionResult;
import io.anuke.mindustry.entities.StatusEffect;
import io.anuke.mindustry.entities.Unit;
import io.anuke.ucore.core.Effects;
import io.anuke.ucore.core.Timers;
import io.anuke.ucore.util.Mathf;
public class StatusEffects {
public static final StatusEffect
@@ -18,6 +21,8 @@ public class StatusEffects {
@Override
public TransitionResult getTransition(Unit unit, StatusEffect to, float time, float newTime, TransitionResult result){
if(to == oiled){
unit.damage(1f, false);
Effects.effect(EnvironmentFx.burning, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
return result.set(this, Math.min(time + newTime, baseDuration + oiled.baseDuration));
}
@@ -26,7 +31,12 @@ public class StatusEffects {
@Override
public void update(Unit unit, float time){
unit.damage(0.04f * Timers.delta());
unit.damage(0.04f * Timers.delta(), false);
if(Mathf.chance(Timers.delta() * 0.2f)){
Effects.effect(EnvironmentFx.burning, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
}
}
},
@@ -37,7 +47,11 @@ public class StatusEffects {
@Override
public void update(Unit unit, float time){
unit.velocity.scl(0.6f);
unit.velocity.scl(0.7f);
if(Mathf.chance(Timers.delta() * 0.15f)){
Effects.effect(EnvironmentFx.freezing, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
}
}
},
@@ -48,6 +62,10 @@ public class StatusEffects {
@Override
public void update(Unit unit, float time){
if(Mathf.chance(Timers.delta() * 0.15f)){
Effects.effect(EnvironmentFx.wet, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
}
unit.velocity.scl(0.999f);
}
},
@@ -69,13 +87,21 @@ public class StatusEffects {
@Override
public void update(Unit unit, float time){
unit.velocity.scl(0.8f);
unit.damage(0.1f * Timers.delta());
unit.damage(0.1f * Timers.delta(), false);
if(Mathf.chance(Timers.delta() * 0.2f)){
Effects.effect(EnvironmentFx.melting, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
}
}
},
oiled = new StatusEffect(4*60f){
@Override
public void update(Unit unit, float time){
if(Mathf.chance(Timers.delta() * 0.15f)){
Effects.effect(EnvironmentFx.oily, unit.x + Mathf.range(unit.getSize()/2f), unit.y + Mathf.range(unit.getSize()/2f));
}
unit.velocity.scl(1.001f);
}
@@ -99,6 +99,7 @@ public class TurretBullets {
drag = 0.07f;
hiteffect = BulletFx.hitFlameSmall;
despawneffect = Fx.none;
status = StatusEffects.burning;
}
@Override
@@ -142,6 +143,7 @@ public class TurretBullets {
{
status = StatusEffects.wet;
statusIntensity = 0.5f;
knockback = 0.65f;
}
},
cryoShot = new LiquidShot(Liquids.cryofluid) {
@@ -187,7 +189,7 @@ public class TurretBullets {
despawneffect = Fx.none;
hiteffect = BulletFx.hitLiquid;
drag = 0.01f;
knockback = 0.65f;
knockback = 0.5f;
}
@Override
@@ -2,6 +2,7 @@ package io.anuke.mindustry.content.fx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.Colors;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
@@ -71,35 +72,35 @@ public class BlockFx {
}),
pulverize = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
Draw.color(Fx.stoneGray);
Draw.color(Palette.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeRed = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
Draw.color(Color.valueOf("ffa480"), Fx.stoneGray, e.fin());
Draw.color(Color.valueOf("ffa480"), Palette.stoneGray, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeRedder = new Effect(40, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin()*9f, (x, y)->{
Draw.color(Color.valueOf("ff7b69"), Fx.stoneGray, e.fin());
Draw.color(Color.valueOf("ff7b69"), Palette.stoneGray, e.fin());
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 2.5f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeSmall = new Effect(30, e -> {
Angles.randLenVectors(e.id, 3, e.fin()*5f, (x, y)->{
Draw.color(Fx.stoneGray);
Draw.color(Palette.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
Draw.reset();
});
}),
pulverizeMedium = new Effect(30, e -> {
Angles.randLenVectors(e.id, 5, 3f + e.fin()*8f, (x, y)->{
Draw.color(Fx.stoneGray);
Draw.color(Palette.stoneGray);
Fill.poly(e.x + x, e.y + y, 4, e.fout() * 1f + 0.5f, 45);
Draw.reset();
});
@@ -0,0 +1,65 @@
package io.anuke.mindustry.content.fx;
import com.badlogic.gdx.graphics.Color;
import io.anuke.mindustry.content.Liquids;
import io.anuke.mindustry.graphics.Palette;
import io.anuke.ucore.core.Effects.Effect;
import io.anuke.ucore.graphics.Draw;
import io.anuke.ucore.graphics.Fill;
import io.anuke.ucore.util.Angles;
import io.anuke.ucore.util.Mathf;
public class EnvironmentFx {
public static final Effect
burning = new Effect(35f, e -> {
Draw.color(Palette.lightFlame, Palette.darkFlame, e.fin());
Angles.randLenVectors(e.id, 3, 2f + e.fin()*7f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, 0.1f + e.fout() * 1.4f);
});
Draw.color();
}),
freezing = new Effect(40f, e -> {
Draw.color(Liquids.cryofluid.color);
Angles.randLenVectors(e.id, 2, 1f + e.fin()*2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1.2f);
});
Draw.color();
}),
melting = new Effect(40f, e -> {
Draw.color(Liquids.lava.color, Color.WHITE, e.fout()/5f + Mathf.randomSeedRange(e.id, 0.12f));
Angles.randLenVectors(e.id, 2, 1f + e.fin()*3f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, .2f + e.fout() * 1.2f);
});
Draw.color();
}),
wet = new Effect(40f, e -> {
Draw.color(Liquids.water.color);
Angles.randLenVectors(e.id, 2, 1f + e.fin()*2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
});
Draw.color();
}),
oily = new Effect(42f, e -> {
Draw.color(Liquids.oil.color);
Angles.randLenVectors(e.id, 2, 1f + e.fin()*2f, (x, y) -> {
Fill.circle(e.x + x, e.y + y, e.fout() * 1f);
});
Draw.color();
});
}
@@ -12,15 +12,6 @@ import io.anuke.ucore.util.Mathf;
public class ExplosionFx {
public static final Effect
generatorexplosion = new Effect(28, 40f, e -> {
Angles.randLenVectors(e.id, 16, 10f + e.fin()*8f, (x, y) -> {
float size = e.fout()*12f + 1f;
Draw.color(Color.WHITE, Color.PURPLE, e.fin());
Draw.rect("circle", e.x + x, e.y + y, size, size);
Draw.reset();
});
}),
shockwave = new Effect(10f, 80f, e -> {
Draw.color(Color.WHITE, Color.LIGHT_GRAY, e.fin());
Lines.stroke(e.fout()*2f + 0.2f);
@@ -10,8 +10,7 @@ import static io.anuke.mindustry.Vars.respawnduration;
import static io.anuke.mindustry.Vars.tilesize;
public class Fx{
public static Color beam = Color.valueOf("9bffbe");
public static Color stoneGray = Color.valueOf("8f8f8f");
public static final Effect