mirror of
https://github.com/Anuken/Mindustry.git
synced 2025-01-05 21:10:53 +07:00
Moved drawMining to UnitType
This commit is contained in:
parent
9dd17ca16b
commit
7d3c94de9b
@ -123,31 +123,4 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
if(!mining()) return;
|
||||
float focusLen = hitSize / 2f + Mathf.absin(Time.time, 1.1f, 0.5f);
|
||||
float swingScl = 12f, swingMag = tilesize / 8f;
|
||||
float flashScl = 0.3f;
|
||||
|
||||
float px = x + Angles.trnsx(rotation, focusLen);
|
||||
float py = y + Angles.trnsy(rotation, focusLen);
|
||||
|
||||
float ex = mineTile.worldx() + Mathf.sin(Time.time + 48, swingScl, swingMag);
|
||||
float ey = mineTile.worldy() + Mathf.sin(Time.time + 48, swingScl + 2f, swingMag);
|
||||
|
||||
Draw.z(Layer.flyingUnit + 0.1f);
|
||||
|
||||
Draw.color(Color.lightGray, Color.white, 1f - flashScl + Mathf.absin(Time.time, 0.5f, flashScl));
|
||||
|
||||
Drawf.laser(Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), px, py, ex, ey, 0.75f);
|
||||
|
||||
if(isLocal()){
|
||||
Lines.stroke(1f, Pal.accent);
|
||||
Lines.poly(mineTile.worldx(), mineTile.worldy(), 4, tilesize / 2f * Mathf.sqrt2, Time.time);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
}
|
||||
|
@ -429,7 +429,8 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
|
||||
//(undocumented, you shouldn't need to use these, and if you do just check how they're drawn and copy that)
|
||||
public TextureRegion baseRegion, legRegion, region, previewRegion, shadowRegion, cellRegion, itemCircleRegion,
|
||||
softShadowRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion, treadRegion;
|
||||
softShadowRegion, jointRegion, footRegion, legBaseRegion, baseJointRegion, outlineRegion, treadRegion,
|
||||
mineLaserRegion, mineLaserEndRegion;
|
||||
public TextureRegion[] wreckRegions, segmentRegions, segmentOutlineRegions;
|
||||
public TextureRegion[][] treadRegions;
|
||||
|
||||
@ -917,6 +918,9 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
legBaseRegion = Core.atlas.find(name + "-leg-base", name + "-leg");
|
||||
baseRegion = Core.atlas.find(name + "-base");
|
||||
cellRegion = Core.atlas.find(name + "-cell", Core.atlas.find("power-cell"));
|
||||
|
||||
mineLaserRegion = Core.atlas.find("minelaser");
|
||||
mineLaserEndRegion = Core.atlas.find("minelaser-end");
|
||||
//when linear filtering is on, it's acceptable to use the relatively low-res 'particle' region
|
||||
softShadowRegion =
|
||||
squareShape ? Core.atlas.find("square-shadow") :
|
||||
@ -1195,6 +1199,8 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
|
||||
unit.drawBuilding();
|
||||
|
||||
drawMining(unit);
|
||||
|
||||
boolean isPayload = !unit.isAdded();
|
||||
|
||||
Mechc mech = unit instanceof Mechc ? (Mechc)unit : null;
|
||||
@ -1298,6 +1304,32 @@ public class UnitType extends UnlockableContent implements Senseable{
|
||||
Draw.reset();
|
||||
}
|
||||
|
||||
public void drawMining(Unit unit){
|
||||
if(!unit.mining()) return;
|
||||
float focusLen = unit.hitSize / 2f + Mathf.absin(Time.time, 1.1f, 0.5f);
|
||||
float swingScl = 12f, swingMag = tilesize / 8f;
|
||||
float flashScl = 0.3f;
|
||||
|
||||
float px = unit.x + Angles.trnsx(unit.rotation, focusLen);
|
||||
float py = unit.y + Angles.trnsy(unit.rotation, focusLen);
|
||||
|
||||
float ex = unit.mineTile.worldx() + Mathf.sin(Time.time + 48, swingScl, swingMag);
|
||||
float ey = unit.mineTile.worldy() + Mathf.sin(Time.time + 48, swingScl + 2f, swingMag);
|
||||
|
||||
Draw.z(Layer.flyingUnit + 0.1f);
|
||||
|
||||
Draw.color(Color.lightGray, Color.white, 1f - flashScl + Mathf.absin(Time.time, 0.5f, flashScl));
|
||||
|
||||
Drawf.laser(mineLaserRegion, mineLaserEndRegion, px, py, ex, ey, 0.75f);
|
||||
|
||||
if(unit.isLocal()){
|
||||
Lines.stroke(1f, Pal.accent);
|
||||
Lines.poly(unit.mineTile.worldx(), unit.mineTile.worldy(), 4, tilesize / 2f * Mathf.sqrt2, Time.time);
|
||||
}
|
||||
|
||||
Draw.color();
|
||||
}
|
||||
|
||||
public <T extends Unit & Payloadc> void drawPayload(T unit){
|
||||
if(unit.hasPayload()){
|
||||
Payload pay = unit.payloads().first();
|
||||
|
Loading…
Reference in New Issue
Block a user