more core info

This commit is contained in:
sharlottes
2021-05-10 15:36:13 +09:00
parent 809168c09d
commit d17badc73d
5 changed files with 193 additions and 37 deletions

View File

@@ -3,7 +3,13 @@ package UnitInfo.core;
import UnitInfo.ui.FreeBar;
import arc.Core;
import arc.Events;
import arc.math.geom.Rect;
import arc.graphics.Color;
import arc.graphics.g2d.Draw;
import arc.math.Angles;
import arc.math.Mathf;
import arc.util.Time;
import arc.util.Tmp;
import mindustry.Vars;
import mindustry.game.EventType.*;
import mindustry.gen.Groups;
import mindustry.mod.Mod;
@@ -12,20 +18,35 @@ public class Main extends Mod {
public static Setting settingAdder = new Setting();
public Main(){
float[] unitFade = {0};
Events.on(ClientLoadEvent.class, e -> {
settingAdder.init();
HudUi hud = new HudUi();
hud.addTable();
hud.addCoreTable();
});
Events.on(WorldLoadEvent.class, e -> {
HudUi hud = new HudUi();
hud.addTable();
hud.addCoreTable();
});
Events.run(Trigger.draw, () -> {
if(Core.settings.getBool("unithealthui"))
Groups.unit.each(unit -> new FreeBar().draw(unit));
});
Events.run(Trigger.teamCoreDamage, () -> {
unitFade[0] = Mathf.lerpDelta(unitFade[0], Mathf.num( Vars.player.unit() != null), 0.1f);
for(int i = 0; i < 4; i++){
float rot = i * 90f + 45f + (-Time.time) % 360f;
float length = Vars.player.unit().hitSize() * 1.5f + (unitFade[0] * 2.5f);
Draw.color(Tmp.c1.set(Color.orange).lerp(Color.scarlet, Mathf.absin(Time.time, 2f, 1f)));
Draw.rect("select-arrow", Vars.player.unit().x + Angles.trnsx(rot, length), Vars.player.unit().y + Angles.trnsy(rot, length), length / 1.9f, length / 1.9f, rot - 135f);
Draw.reset();
}
});
}
@Override