Fixed unit drowning effects
This commit is contained in:
@@ -9,6 +9,7 @@ import arc.util.*;
|
||||
import mindustry.content.*;
|
||||
import mindustry.gen.*;
|
||||
import mindustry.graphics.*;
|
||||
import mindustry.world.*;
|
||||
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@@ -69,6 +70,9 @@ public class Effects{
|
||||
public static void scorch(float x, float y, int size){
|
||||
if(headless) return;
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
if(tile == null || tile.floor().isLiquid) return;
|
||||
|
||||
size = Mathf.clamp(size, 0, 9);
|
||||
|
||||
TextureRegion region = Core.atlas.find("scorch-" + size + "-" + Mathf.random(2));
|
||||
@@ -79,6 +83,9 @@ public class Effects{
|
||||
public static void rubble(float x, float y, int blockSize){
|
||||
if(headless) return;
|
||||
|
||||
Tile tile = world.tileWorld(x, y);
|
||||
if(tile == null || tile.floor().isLiquid) return;
|
||||
|
||||
TextureRegion region = Core.atlas.find("rubble-" + blockSize + "-" + (Core.atlas.has("rubble-" + blockSize + "-1") ? Mathf.random(0, 1) : "0"));
|
||||
decal(region, x, y, Mathf.random(4) * 90, 3600, Pal.rubble);
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ public class Planet extends UnlockableContent{
|
||||
|
||||
sectors = new Array<>(grid.tiles.length);
|
||||
for(int i = 0; i < grid.tiles.length; i++){
|
||||
//TODO load sector data
|
||||
sectors.add(new Sector(this, grid.tiles[i], new SectorData()));
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void drawItems(Unitc unit){
|
||||
applyColor(unit);
|
||||
|
||||
//draw back items
|
||||
if(unit.hasItem() && unit.itemTime() > 0.01f){
|
||||
@@ -154,7 +155,7 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void drawWeapons(Unitc unit){
|
||||
Draw.mixcol(Color.white, unit.hitTime());
|
||||
applyColor(unit);
|
||||
|
||||
for(WeaponMount mount : unit.mounts()){
|
||||
Weapon weapon = mount.weapon;
|
||||
@@ -179,7 +180,7 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void drawBody(Unitc unit){
|
||||
Draw.mixcol(Color.white, unit.hitTime());
|
||||
applyColor(unit);
|
||||
|
||||
Draw.rect(region, unit, unit.rotation() - 90);
|
||||
|
||||
@@ -187,9 +188,11 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void drawCell(Unitc unit){
|
||||
applyColor(unit);
|
||||
|
||||
Draw.color(Color.black, unit.team().color, unit.healthf() + Mathf.absin(Time.time(), Math.max(unit.healthf() * 5f, 1f), 1f - unit.healthf()));
|
||||
Draw.rect(cellRegion, unit, unit.rotation() - 90);
|
||||
Draw.color();
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void drawLight(Unitc unit){
|
||||
@@ -227,5 +230,12 @@ public class UnitType extends UnlockableContent{
|
||||
Draw.mixcol();
|
||||
}
|
||||
|
||||
public void applyColor(Unitc unit){
|
||||
Draw.mixcol(Color.white, unit.hitTime());
|
||||
if(unit.drownTime() > 0 && unit.floorOn().isDeep()){
|
||||
Draw.mixcol(unit.floorOn().color, unit.drownTime() * 0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
//endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user