1
0
mirror of https://github.com/Anuken/Mindustry.git synced 2024-11-11 14:56:10 +03:00

Unit tweaks

This commit is contained in:
Anuken 2020-04-25 22:48:25 -04:00
parent c875bb3f55
commit 8b7d75c5ba
8 changed files with 463 additions and 450 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 531 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 B

After

Width:  |  Height:  |  Size: 901 B

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 762 KiB

After

Width:  |  Height:  |  Size: 762 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 128 KiB

After

Width:  |  Height:  |  Size: 128 KiB

View File

@ -5,6 +5,7 @@ import arc.graphics.*;
import arc.graphics.g2d.*;
import arc.math.*;
import arc.math.geom.*;
import mindustry.graphics.*;
public class Effect{
private static final EffectContainer container = new EffectContainer();
@ -75,6 +76,7 @@ public class Effect{
public void render(int id, Color color, float life, float rotation, float x, float y, Object data){
container.set(id, color, life, lifetime, rotation, x, y, data);
Draw.z(ground ? Layer.debris : Layer.effect);
renderer.get(container);
Draw.reset();
}

View File

@ -16,7 +16,6 @@ abstract class EffectComp implements Posc, Drawc, Timedc, Rotc, Childc{
@Override
public void draw(){
Draw.z(Layer.effect);
effect.render(id(), color, time(), rotation(), x(), y(), data);
}

View File

@ -120,13 +120,17 @@ public class UnitType extends UnlockableContent{
drawShadow(unit);
}
Draw.z(Mathf.lerp(Layer.groundUnit, Layer.flyingUnit, unit.elevation()));
float z = Mathf.lerp(Layer.groundUnit, Layer.flyingUnit, unit.elevation());
Draw.z(z - 0.02f);
if(unit instanceof Legsc){
drawLegs((Legsc)unit);
}
Draw.z(z - 0.01f);
drawOcclusion(unit);
Draw.z(z);
drawEngine(unit);
drawBody(unit);
drawWeapons(unit);
@ -185,7 +189,7 @@ public class UnitType extends UnlockableContent{
public void drawEngine(Unitc unit){
if(!unit.isFlying()) return;
Draw.color(unit.team().color, Color.white, 0f);
Draw.color(unit.team().color);
Fill.circle(
unit.x() + Angles.trnsx(unit.rotation() + 180, engineOffset),
unit.y() + Angles.trnsy(unit.rotation() + 180, engineOffset),
@ -211,13 +215,14 @@ public class UnitType extends UnlockableContent{
float rotation = unit.rotation() - 90;
float weaponRotation = rotation + (weapon.rotate ? mount.rotation : 0);
float trY = weapon.y;
float width = i > 0 ? -weapon.region.getWidth() : weapon.region.getWidth();
float recoil = -(mount.reload / weapon.reload * weapon.recoil) * (weapon.alternate ? Mathf.num(i == Mathf.sign(mount.side)) : 1);
if(weapon.mirror) rotation = weaponRotation;
Draw.rect(weapon.region,
unit.x() + Angles.trnsx(rotation, weapon.x * i, trY) + Angles.trnsx(weaponRotation, 0, recoil),
unit.y() + Angles.trnsy(rotation, weapon.x * i, trY) + Angles.trnsy(weaponRotation, 0, recoil),
unit.x() + Angles.trnsx(rotation, weapon.x * i, weapon.y) + Angles.trnsx(weaponRotation, 0, recoil),
unit.y() + Angles.trnsy(rotation, weapon.x * i, weapon.y) + Angles.trnsy(weaponRotation, 0, recoil),
width * Draw.scl,
weapon.region.getHeight() * Draw.scl,
weaponRotation);