let mechs override drawStats and do custom power cell stuff (#1309)
* let mechs override drawStats and do custom power cell stuff * Update Player.java * Update Mech.java * Update Player.java
This commit is contained in:
@@ -350,13 +350,13 @@ public class Player extends Unit implements BuilderMinerTrait, ShooterTrait{
|
|||||||
Draw.reset();
|
Draw.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawBackItems(){
|
||||||
|
drawBackItems(itemtime, isLocal);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawStats(){
|
public void drawStats(){
|
||||||
Draw.color(Color.black, team.color, healthf() + Mathf.absin(Time.time(), healthf() * 5f, 1f - healthf()));
|
mech.drawStats(this);
|
||||||
Draw.rect(getPowerCellRegion(), x + Angles.trnsx(rotation, mech.cellTrnsY, 0f), y + Angles.trnsy(rotation, mech.cellTrnsY, 0f), rotation - 90);
|
|
||||||
Draw.reset();
|
|
||||||
drawBackItems(itemtime, isLocal);
|
|
||||||
drawLight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package mindustry.type;
|
|||||||
|
|
||||||
import arc.Core;
|
import arc.Core;
|
||||||
import arc.graphics.Color;
|
import arc.graphics.Color;
|
||||||
import arc.graphics.g2d.TextureRegion;
|
import arc.graphics.g2d.*;
|
||||||
|
import arc.math.*;
|
||||||
import arc.scene.ui.layout.Table;
|
import arc.scene.ui.layout.Table;
|
||||||
import arc.util.ArcAnnotate.*;
|
import arc.util.ArcAnnotate.*;
|
||||||
|
import arc.util.Time;
|
||||||
import mindustry.ctype.ContentType;
|
import mindustry.ctype.ContentType;
|
||||||
import mindustry.entities.type.Player;
|
import mindustry.entities.type.Player;
|
||||||
import mindustry.ctype.UnlockableContent;
|
import mindustry.ctype.UnlockableContent;
|
||||||
@@ -32,6 +34,13 @@ public class Mech extends UnlockableContent{
|
|||||||
public boolean canHeal = false;
|
public boolean canHeal = false;
|
||||||
public float compoundSpeed, compoundSpeedBoost;
|
public float compoundSpeed, compoundSpeedBoost;
|
||||||
|
|
||||||
|
/** draw the health and team indicator */
|
||||||
|
public boolean drawCell = true;
|
||||||
|
/** draw the items on its back */
|
||||||
|
public boolean drawItems = true;
|
||||||
|
/** draw the engine light if it's flying/boosting */
|
||||||
|
public boolean drawLight = true;
|
||||||
|
|
||||||
public float weaponOffsetX, weaponOffsetY, engineOffset = 5f, engineSize = 2.5f;
|
public float weaponOffsetX, weaponOffsetY, engineOffset = 5f, engineSize = 2.5f;
|
||||||
public @NonNull Weapon weapon;
|
public @NonNull Weapon weapon;
|
||||||
|
|
||||||
@@ -52,6 +61,24 @@ public class Mech extends UnlockableContent{
|
|||||||
public void draw(Player player){
|
public void draw(Player player){
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void drawStats(Player player){
|
||||||
|
if(drawCell){
|
||||||
|
float health = player.healthf();
|
||||||
|
Draw.color(Color.black, player.getTeam().color, health + Mathf.absin(Time.time(), health * 5f, 1f - health));
|
||||||
|
Draw.rect(player.getPowerCellRegion(),
|
||||||
|
player.x + Angles.trnsx(player.rotation, cellTrnsY, 0f),
|
||||||
|
player.y + Angles.trnsy(player.rotation, cellTrnsY, 0f),
|
||||||
|
player.rotation - 90);
|
||||||
|
Draw.reset();
|
||||||
|
}
|
||||||
|
if(drawItems){
|
||||||
|
player.drawBackItems();
|
||||||
|
}
|
||||||
|
if(drawLight){
|
||||||
|
player.drawLight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public float getExtraArmor(Player player){
|
public float getExtraArmor(Player player){
|
||||||
return 0f;
|
return 0f;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user