Improved payload deconstructor visuals
This commit is contained in:
@@ -652,7 +652,11 @@ public class UnitType extends UnlockableContent{
|
||||
}
|
||||
|
||||
public void drawSoftShadow(Unit unit){
|
||||
Draw.color(0, 0, 0, 0.4f);
|
||||
drawSoftShadow(unit, 1f);
|
||||
}
|
||||
|
||||
public void drawSoftShadow(Unit unit, float alpha){
|
||||
Draw.color(0, 0, 0, 0.4f * alpha);
|
||||
float rad = 1.6f;
|
||||
float size = Math.max(region.width, region.height) * Draw.scl;
|
||||
Draw.rect(softShadowRegion, unit, size * rad * Draw.xscl, size * rad * Draw.yscl);
|
||||
|
||||
@@ -72,9 +72,14 @@ public class BuildPayload implements Payload{
|
||||
build.set(x, y);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(float alpha){
|
||||
Drawf.shadow(build.x, build.y, build.block.size * tilesize * 2f, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
Drawf.shadow(build.x, build.y, build.block.size * tilesize * 2f);
|
||||
drawShadow(1f);
|
||||
Draw.rect(build.block.fullIcon, build.x, build.y);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ public interface Payload extends Position{
|
||||
/** draws this payload at a position. */
|
||||
void draw();
|
||||
|
||||
void drawShadow(float alpha);
|
||||
|
||||
/** @return hitbox size of the payload. */
|
||||
float size();
|
||||
|
||||
|
||||
@@ -65,16 +65,15 @@ public class PayloadDeconstructor extends PayloadBlock{
|
||||
deconstructing.set(x + payVector.x, y + payVector.y, payRotation);
|
||||
|
||||
Draw.z(Layer.blockOver);
|
||||
//deconstructing.draw();
|
||||
deconstructing.drawShadow(1f - progress);
|
||||
|
||||
//TODO shadow
|
||||
//TODO looks really bad
|
||||
Draw.draw(Layer.blockOver, () -> {
|
||||
Drawf.construct(x, y, deconstructing.icon(), Pal.remove, 0f, 1f - progress, 1f - progress, time);
|
||||
Drawf.construct(x, y, deconstructing.icon(), Pal.remove, payRotation - 90f, 1f - progress, 1f - progress, time);
|
||||
Draw.color(Pal.remove);
|
||||
Draw.alpha(1f);
|
||||
|
||||
Lines.lineAngleCenter(x + Mathf.sin(time, 20f, Vars.tilesize / 2f * block.size - 3f), y, 90, block.size * Vars.tilesize - 6f);
|
||||
Lines.lineAngleCenter(x + Mathf.sin(time, 20f, Vars.tilesize / 2f * block.size - 3f), y, 90f, block.size * Vars.tilesize - 6f);
|
||||
|
||||
Draw.reset();
|
||||
});
|
||||
@@ -106,6 +105,8 @@ public class PayloadDeconstructor extends PayloadBlock{
|
||||
progress = 0f;
|
||||
}
|
||||
|
||||
payRotation = Angles.moveToward(payRotation, 90f, payloadRotateSpeed * edelta());
|
||||
|
||||
if(deconstructing != null){
|
||||
var reqs = deconstructing.requirements();
|
||||
if(accum == null || reqs.length != accum.length){
|
||||
|
||||
@@ -104,6 +104,14 @@ public class UnitPayload implements Payload{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawShadow(float alpha){
|
||||
//TODO should not happen
|
||||
if(unit.type == null) return;
|
||||
|
||||
unit.type.drawSoftShadow(unit, alpha);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(){
|
||||
//TODO should not happen
|
||||
|
||||
Reference in New Issue
Block a user