1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-09-11 08:15:35 +03:00

Unit selection overlay improvements

This commit is contained in:
Anuken 2024-04-17 23:28:01 -04:00
parent b8c6781004
commit 243cc1e527
3 changed files with 15 additions and 2 deletions

View File

@ -131,7 +131,9 @@ public class OverlayRenderer{
Building build = (select instanceof BlockUnitc b ? b.tile() : select instanceof Building b ? b : null);
TextureRegion region = build != null ? build.block.fullIcon : select instanceof Unit u ? u.icon() : Core.atlas.white();
Draw.rect(region, select.getX(), select.getY(), select instanceof Unit u && !(select instanceof BlockUnitc) ? u.rotation - 90f : 0f);
if(!(select instanceof Unitc)){
Draw.rect(region, select.getX(), select.getY());
}
for(int i = 0; i < 4; i++){
float rot = i * 90f + 45f + (-Time.time) % 360f;
@ -255,6 +257,12 @@ public class OverlayRenderer{
}
}
public void checkApplySelection(Unit u){
if(unitFade > 0 && lastSelect == u){
Draw.mixcol(Pal.accent, unitFade);
}
}
private static class CoreEdge{
float x1, y1, x2, y2;
Team t1, t2;

View File

@ -1465,6 +1465,7 @@ public class UnitType extends UnlockableContent implements Senseable{
}
public <T extends Unit & Tankc> void drawTank(T unit){
applyColor(unit);
Draw.rect(treadRegion, unit.x, unit.y, unit.rotation - 90);
if(treadRegion.found()){
@ -1636,6 +1637,10 @@ public class UnitType extends UnlockableContent implements Senseable{
if(unit.drownTime > 0 && unit.lastDrownFloor != null){
Draw.mixcol(Tmp.c1.set(unit.lastDrownFloor.mapColor).mul(0.83f), unit.drownTime * 0.9f);
}
//this is horribly scuffed.
if(renderer != null && renderer.overlays != null){
renderer.overlays.checkApplySelection(unit);
}
}
//endregion

View File

@ -25,4 +25,4 @@ org.gradle.caching=true
#used for slow jitpack builds; TODO see if this actually works
org.gradle.internal.http.socketTimeout=100000
org.gradle.internal.http.connectionTimeout=100000
archash=8a2decd656
archash=e812c7a008