Added alternate health bar on all units
This commit is contained in:
@@ -263,6 +263,23 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
Draw.rect(mech.iconRegion, x , y, rotation - 90);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawAll(){
|
||||
boolean snap = snapCamera && isLocal;
|
||||
|
||||
float px = x, py = y;
|
||||
|
||||
if(snap){
|
||||
x = (int) (x + 0.0001f);
|
||||
y = (int) (y + 0.0001f);
|
||||
}
|
||||
|
||||
super.drawAll();
|
||||
|
||||
x = px;
|
||||
y = py;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
if((debug && (!showPlayer || !showUI)) || dead) return;
|
||||
@@ -274,15 +291,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
|
||||
boostHeat = Mathf.lerpDelta(boostHeat, isBoosting && ((!movement.isZero() && moved) || !isLocal) ? 1f : 0f, 0.08f);
|
||||
|
||||
boolean snap = snapCamera && isLocal;
|
||||
|
||||
float px = x, py = y;
|
||||
|
||||
if(snap){
|
||||
x = (int) (x + 0.0001f);
|
||||
y = (int) (y + 0.0001f);
|
||||
}
|
||||
|
||||
float ft = Mathf.sin(walktime, 6f, 2f) * (1f - boostHeat);
|
||||
|
||||
Floor floor = getFloorOn();
|
||||
@@ -341,9 +349,6 @@ public class Player extends Unit implements BuilderTrait, CarryTrait, ShooterTra
|
||||
}
|
||||
|
||||
Draw.alpha(1f);
|
||||
|
||||
x = px;
|
||||
y = py;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package io.anuke.mindustry.entities;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion;
|
||||
import com.badlogic.gdx.math.Vector2;
|
||||
import io.anuke.mindustry.content.blocks.Blocks;
|
||||
@@ -306,6 +307,24 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
public void drawOver(){
|
||||
}
|
||||
|
||||
public void drawStats(){
|
||||
Draw.color(Color.BLACK, team.color, healthf() + Mathf.absin(Timers.time(), healthf()*5f, 1f - healthf()));
|
||||
Draw.alpha(hitTime);
|
||||
Draw.rect(getPowerCellRegion(), x, y, rotation - 90);
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public TextureRegion getPowerCellRegion(){
|
||||
return Draw.region("power-cell");
|
||||
}
|
||||
|
||||
public void drawAll(){
|
||||
if(!isDead()){
|
||||
draw();
|
||||
drawStats();
|
||||
}
|
||||
}
|
||||
|
||||
public void drawShadow(){
|
||||
Draw.rect(getIconRegion(), x , y, rotation - 90);
|
||||
}
|
||||
@@ -314,10 +333,6 @@ public abstract class Unit extends DestructibleEntity implements SaveTrait, Targ
|
||||
Fill.circle(x, y, getViewDistance());
|
||||
}
|
||||
|
||||
public boolean isInfiniteAmmo(){
|
||||
return false;
|
||||
}
|
||||
|
||||
public float getViewDistance(){
|
||||
return 135f;
|
||||
}
|
||||
|
||||
@@ -252,11 +252,6 @@ public abstract class BaseUnit extends Unit implements ShooterTrait{
|
||||
return type.itemCapacity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfiniteAmmo(){
|
||||
return isWave;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void interpolate(){
|
||||
super.interpolate();
|
||||
|
||||
Reference in New Issue
Block a user