i still like xelo well

This commit is contained in:
sharlottes
2022-04-16 18:49:06 +09:00
parent 1ce4b31a5a
commit ac4bdc0090

View File

@@ -46,10 +46,10 @@ public class OverDrawer {
public static boolean locked;
public static ObjectMap<Team, Seq<BaseTurret.BaseTurretBuild>> tmpbuildobj = new ObjectMap<>();
static float sin = Mathf.absin(Time.time, 6f, 1f);
public static void setEvent(){
Events.run(EventType.Trigger.draw, () -> {
float sin = Mathf.absin(Time.time, 6f, 1f);
effectBuffer.resize(graphics.getWidth(), graphics.getHeight());
Draw.z(Layer.max);
@@ -238,6 +238,7 @@ public class OverDrawer {
public static void drawMassPayloadLink(PayloadMassDriver.PayloadDriverBuild from){
float sin = Mathf.absin(Time.time, 6f, 1f);
Groups.build.each(b -> b instanceof PayloadMassDriver.PayloadDriverBuild fromMass &&
world.build(fromMass.link) == from &&
from.within(fromMass.x, fromMass.y, ((PayloadMassDriver)fromMass.block).range) &&
@@ -277,43 +278,39 @@ public class OverDrawer {
}
}
public static void drawMassLink(MassDriver.MassDriverBuild from){
static void drawMassLink(MassDriver.MassDriverBuild from){
float sin = Mathf.absin(Time.time, 6f, 1f);
Groups.build.each(b -> {
if(b instanceof MassDriver.MassDriverBuild fromMass &&
world.build(fromMass.link) == from &&
!linkedMasses.contains(fromMass)) {
//call every mass drivers that link to this driver
for(Building b : Groups.build) {
if (b != from && b instanceof MassDriver.MassDriverBuild fromMass && world.build(fromMass.link) == from && !linkedMasses.contains(fromMass)) {
linkedMasses.add(fromMass);
drawMassLink(fromMass);
}
});
if(world.build(from.link) instanceof MassDriver.MassDriverBuild to){
Tmp.v1.set(from.x + from.block.offset, from.y + from.block.offset).sub(to.x, to.y).limit(from.block.size * tilesize + sin + 0.5f);
float x2 = from.x - Tmp.v1.x, y2 = from.y - Tmp.v1.y, x1 = to.x + Tmp.v1.x, y1 = to.y + Tmp.v1.y;
int segs = (int)(to.dst(from.x, from.y)/tilesize);
}
//get and draw line between this mass driver and linked one
Building target = world.build(from.link);
if(target instanceof MassDriver.MassDriverBuild targetDriver) {
Tmp.v1.set(from.x + from.block.offset, from.y + from.block.offset).sub(targetDriver.x, targetDriver.y).limit(from.block.size * tilesize + sin + 0.5f);
float x2 = from.x - Tmp.v1.x, y2 = from.y - Tmp.v1.y, x1 = targetDriver.x + Tmp.v1.x, y1 = targetDriver.y + Tmp.v1.y;
int segs = (int) (targetDriver.dst(from.x, from.y) / tilesize);
Lines.stroke(4f, Pal.gray);
Lines.dashLine(x1, y1, x2, y2, segs);
Lines.stroke(2f, Pal.placing);
Lines.dashLine(x1, y1, x2, y2, segs);
Lines.stroke(1f, Pal.accent);
Drawf.circles(from.x, from.y, (from.tile.block().size / 2f + 1) * tilesize + sin - 2f, Pal.accent);
for(var shooter : from.waitingShooters){
Drawf.arrow(from.x, from.y, targetDriver.x, targetDriver.y, from.block.size * tilesize + sin, 4f + sin);
for (Building shooter : from.waitingShooters) {
Drawf.circles(shooter.x, shooter.y, (from.tile.block().size / 2f + 1) * tilesize + sin - 2f);
Drawf.arrow(shooter.x, shooter.y, from.x, from.y, from.block.size * tilesize + sin, 4f + sin);
}
if(from.link != -1 && world.build(from.link) instanceof MassDriver.MassDriverBuild other && other.block == from.block && other.team == from.team && from.within(other, ((MassDriver)from.block).range)){
Building target = world.build(from.link);
Drawf.circles(target.x, target.y, (target.block().size / 2f + 1) * tilesize + sin - 2f);
Drawf.arrow(from.x, from.y, target.x, target.y, from.block.size * tilesize + sin, 4f + sin);
}
if(world.build(to.link) instanceof MassDriver.MassDriverBuild newTo && to != newTo &&
newTo.within(to.x, to.y, ((MassDriver)to.block).range) && !linkedMasses.contains(to)){
linkedMasses.add(to);
drawMassLink(to);
//call method again when target links to another mass driver which isn't stored in array
if(!linkedMasses.contains(targetDriver)) {
linkedMasses.add(targetDriver);
drawMassLink(targetDriver);
}
}
}