From 5b163d78432bffdf5d5b67679305203519231065 Mon Sep 17 00:00:00 2001 From: Sunny Kim <58885089+sk7725@users.noreply.github.com> Date: Tue, 22 Dec 2020 10:04:04 +0900 Subject: [PATCH] Heat for accelerator (#4065) * heat * better animations --- .../world/blocks/campaign/Accelerator.java | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/core/src/mindustry/world/blocks/campaign/Accelerator.java b/core/src/mindustry/world/blocks/campaign/Accelerator.java index 96bc2b1b44..b5a33bc2d3 100644 --- a/core/src/mindustry/world/blocks/campaign/Accelerator.java +++ b/core/src/mindustry/world/blocks/campaign/Accelerator.java @@ -50,37 +50,48 @@ public class Accelerator extends Block{ } public class AcceleratorBuild extends Building{ + public float heat, statusLerp; + @Override + public void updateTile(){ + super.updateTile(); + heat = Mathf.lerpDelta(heat, consValid() ? 1f : 0f, 0.05f); + statusLerp = Mathf.lerpDelta(statusLerp, power.status, 0.05f); + } + @Override public void draw(){ super.draw(); for(int l = 0; l < 4; l++){ float length = 7f + l * 5f; - Draw.color(team.color, Pal.darkMetal, Mathf.absin(Time.time + l*50f, 10f, 1f)); + Draw.color(Tmp.c1.set(Pal.darkMetal).lerp(team.color, statusLerp), Pal.darkMetal, Mathf.absin(Time.time + l*50f, 10f, 1f)); for(int i = 0; i < 4; i++){ float rot = i*90f + 45f; Draw.rect(arrowRegion, x + Angles.trnsx(rot, length), y + Angles.trnsy(rot, length), rot + 180f); } } + + if(heat < 0.0001f) return; float rad = size * tilesize / 2f * 0.74f; float scl = 2f; Draw.z(Layer.bullet - 0.0001f); - Lines.stroke(1.75f, Pal.accent); + Lines.stroke(1.75f * heat, Pal.accent); Lines.square(x, y, rad * 1.22f, 45f); - Lines.stroke(3f, Pal.accent); + Lines.stroke(3f * heat, Pal.accent); Lines.square(x, y, rad, Time.time / scl); Lines.square(x, y, rad, -Time.time / scl); Draw.color(team.color); + Draw.alpha(Mathf.clamp(heat * 3f)); for(int i = 0; i < 4; i++){ float rot = i*90f + 45f + (-Time.time /3f)%360f; - float length = 26f; + float length = 26f * heat; Draw.rect(arrowRegion, x + Angles.trnsx(rot, length), y + Angles.trnsy(rot, length), rot + 180f); }