Autogenerated render layer groups
This commit is contained in:
@@ -22,9 +22,6 @@ class AllEntities{
|
||||
@EntityDef({UnitComp.class})
|
||||
class GenericUnitDef{}
|
||||
|
||||
@EntityDef({BuilderComp.class})
|
||||
class GenericBuilderDef{}
|
||||
|
||||
@GroupDef(EntityComp.class)
|
||||
void all(){
|
||||
|
||||
@@ -45,11 +42,6 @@ class AllEntities{
|
||||
|
||||
}
|
||||
|
||||
@GroupDef(DrawComp.class)
|
||||
void drawer(){
|
||||
|
||||
}
|
||||
|
||||
@GroupDef(SyncComp.class)
|
||||
void sync(){
|
||||
|
||||
|
||||
@@ -6,13 +6,27 @@ import mindustry.annotations.Annotations.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
@Component
|
||||
abstract class DrawShadowComp implements Drawc, Rotc, Flyingc{
|
||||
abstract class DrawShadowComp implements Drawc, Rotc, Flyingc, DrawLayerFlyingShadowsc, DrawLayerGroundShadowsc{
|
||||
static final float shadowTX = -12, shadowTY = -13, shadowColor = Color.toFloatBits(0, 0, 0, 0.22f);
|
||||
|
||||
transient float x, y, rotation;
|
||||
|
||||
abstract TextureRegion getShadowRegion();
|
||||
|
||||
@Override
|
||||
public void drawFlyingShadows(){
|
||||
if(isFlying()){
|
||||
drawShadow();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawGroundShadows(){
|
||||
if(isGrounded()){
|
||||
drawShadow();
|
||||
}
|
||||
}
|
||||
|
||||
void drawShadow(){
|
||||
if(!isGrounded()){
|
||||
Draw.color(shadowColor);
|
||||
|
||||
@@ -21,6 +21,10 @@ abstract class FlyingComp implements Posc, Velc, Healthc{
|
||||
return elevation < 0.001f;
|
||||
}
|
||||
|
||||
boolean isFlying(){
|
||||
return elevation >= 0.001f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
Floor floor = floorOn();
|
||||
|
||||
@@ -19,10 +19,20 @@ import mindustry.world.blocks.*;
|
||||
import static mindustry.Vars.*;
|
||||
|
||||
@Component
|
||||
abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitboxc, Rotc, Massc, Unitc, Weaponsc{
|
||||
abstract class UnitComp implements Healthc, Velc, Statusc, Teamc, Itemsc, Hitboxc, Rotc, Massc, Unitc, Weaponsc, DrawShadowc{
|
||||
private UnitController controller;
|
||||
private UnitDef type;
|
||||
|
||||
@Override
|
||||
public TextureRegion getShadowRegion(){
|
||||
return type.region;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float clipSize(){
|
||||
return type.region.getWidth() * 2f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int itemCapacity(){
|
||||
return type.itemCapacity;
|
||||
|
||||
Reference in New Issue
Block a user