Move back to UnitType

This commit is contained in:
MEEPofFaith
2025-02-08 21:43:56 -08:00
parent 3561562624
commit 78aa3b1848
3 changed files with 31 additions and 14 deletions

View File

@@ -124,16 +124,6 @@ abstract class MinerComp implements Itemsc, Posc, Teamc, Rotc, Drawc{
}
}
public void drawMining(){
if(type.drawMineBeam){
float focusLen = type.mineBeamOffset + Mathf.absin(Time.time, 1.1f, 0.5f);
float px = x + Angles.trnsx(rotation, focusLen);
float py = y + Angles.trnsy(rotation, focusLen);
drawMiningBeam(px, py);
}
}
public void drawMiningBeam(float px, float py){
if(!mining()) return;
float swingScl = 12f, swingMag = tilesize / 8f;

View File

@@ -1232,7 +1232,7 @@ public class UnitType extends UnlockableContent implements Senseable{
if(unit.inFogTo(Vars.player.team())) return;
unit.drawBuilding();
unit.drawMining();
drawMining(unit);
boolean isPayload = !unit.isAdded();
@@ -1344,9 +1344,36 @@ public class UnitType extends UnlockableContent implements Senseable{
return shieldColor == null ? unit.team.color : shieldColor;
}
@Deprecated
public void drawMining(Unit unit){
unit.drawMining();
if(drawMineBeam){
float focusLen = mineBeamOffset + Mathf.absin(Time.time, 1.1f, 0.5f);
float px = unit.x + Angles.trnsx(unit.rotation, focusLen);
float py = unit.y + Angles.trnsy(unit.rotation, focusLen);
drawMiningBeam(px, py);
}
}
public void drawMiningBeam(Unit unit, float px, float py){
if(!unit.mining()) return;
float swingScl = 12f, swingMag = tilesize / 8f;
float flashScl = 0.3f;
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(Core.atlas.find("minelaser"), Core.atlas.find("minelaser-end"), 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){

View File

@@ -60,7 +60,7 @@ public class MineWeapon extends Weapon{
px = wx + Angles.trnsx(weaponRotation, shootX, sY),
py = wy + Angles.trnsy(weaponRotation, shootX, sY);
unit.drawMiningBeam(px, py);
unit.type.drawMiningBeam(px, py);
Draw.z(z);
}
}