?
This commit is contained in:
@@ -209,6 +209,7 @@ public class Renderer implements ApplicationListener{
|
||||
blocks.drawBlocks(Layer.overlay);
|
||||
|
||||
Groups.drawGroundShadows();
|
||||
Groups.drawGroundUnder();
|
||||
Groups.drawGround();
|
||||
|
||||
blocks.drawBlocks(Layer.turret);
|
||||
|
||||
@@ -4,13 +4,13 @@ import mindustry.annotations.Annotations.*;
|
||||
|
||||
class AllEntities{
|
||||
|
||||
@EntityDef({BulletComp.class, VelComp.class, TimedComp.class})
|
||||
@EntityDef(value = {BulletComp.class, VelComp.class, TimedComp.class}, pooled = true)
|
||||
class BulletDef{}
|
||||
|
||||
@EntityDef(value = {TileComp.class}, isFinal = false)
|
||||
class TileDef{}
|
||||
|
||||
@EntityDef({EffectComp.class})
|
||||
@EntityDef(value = {EffectComp.class}, pooled = true)
|
||||
class EffectDef{}
|
||||
|
||||
@EntityDef({DecalComp.class})
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
package mindustry.entities.def;
|
||||
|
||||
import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class DrawLightComp implements Drawc{
|
||||
void drawLight(){}
|
||||
}
|
||||
@@ -8,12 +8,17 @@ import mindustry.gen.*;
|
||||
import mindustry.world.blocks.*;
|
||||
|
||||
@Component
|
||||
abstract class LegsComp implements Posc, Flyingc, Hitboxc{
|
||||
abstract class LegsComp implements Posc, Flyingc, Hitboxc, DrawLayerGroundUnderc{
|
||||
transient float x, y;
|
||||
|
||||
float baseRotation, walkTime;
|
||||
|
||||
void drawLegs(){
|
||||
abstract TextureRegion legRegion();
|
||||
abstract TextureRegion baseRegion();
|
||||
|
||||
@Override
|
||||
public void drawGroundUnder(){
|
||||
Draw.mixcol(Color.white, hitAlpha());
|
||||
TextureRegion legRegion = null, baseRegion = null;
|
||||
|
||||
float ft = Mathf.sin(walkTime * vel().len() * 5f, 6f, 2f + hitSize() / 15f);
|
||||
|
||||
@@ -24,10 +29,10 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc{
|
||||
}
|
||||
|
||||
for(int i : Mathf.signs){
|
||||
Draw.rect(legRegion,
|
||||
x() + Angles.trnsx(baseRotation, ft * i),
|
||||
y() + Angles.trnsy(baseRotation, ft * i),
|
||||
legRegion.getWidth() * i * Draw.scl, legRegion.getHeight() * Draw.scl - Mathf.clamp(ft * i, 0, 2), baseRotation - 90);
|
||||
Draw.rect(legRegion(),
|
||||
x + Angles.trnsx(baseRotation, ft * i),
|
||||
y + Angles.trnsy(baseRotation, ft * i),
|
||||
legRegion().getWidth() * i * Draw.scl, legRegion().getHeight() * Draw.scl - Mathf.clamp(ft * i, 0, 2), baseRotation - 90);
|
||||
}
|
||||
|
||||
if(floor.isLiquid){
|
||||
@@ -36,7 +41,7 @@ abstract class LegsComp implements Posc, Flyingc, Hitboxc{
|
||||
Draw.color(Color.white);
|
||||
}
|
||||
|
||||
Draw.rect(baseRegion, x(), y(), baseRotation - 90);
|
||||
Draw.rect(baseRegion(), x, y, baseRotation - 90);
|
||||
|
||||
Draw.mixcol();
|
||||
}
|
||||
|
||||
@@ -25,6 +25,14 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
private UnitController controller;
|
||||
private UnitDef type;
|
||||
|
||||
TextureRegion baseRegion(){
|
||||
return type.baseRegion;
|
||||
}
|
||||
|
||||
TextureRegion legRegion(){
|
||||
return type.legRegion;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureRegion getShadowRegion(){
|
||||
return type.region;
|
||||
@@ -112,6 +120,10 @@ abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitbox
|
||||
@Override
|
||||
public void draw(){
|
||||
drawCell();
|
||||
|
||||
if(type.lightRadius > 0){
|
||||
renderer.lights.add(x, y, type.lightRadius, type.lightColor, type.lightOpacity);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,7 @@ public class UnitDef extends UnlockableContent{
|
||||
|
||||
public float hitsize = 6f, hitsizeTile = 4f;
|
||||
public float cellOffsetX = 0f, cellOffsetY = 0f;
|
||||
public float lightRadius = 60f;
|
||||
public float lightRadius = 60f, lightOpacity = 0.6f;
|
||||
public Color lightColor = Pal.powerLight;
|
||||
public boolean drawCell = true, drawItems = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user