Entity components based on code generation - experiment

This commit is contained in:
Anuken
2020-02-01 23:54:41 -05:00
parent 9f20ff151c
commit da2aee7d31
9 changed files with 477 additions and 89 deletions

View File

@@ -0,0 +1,48 @@
package mindustry.entities.def;
import arc.math.geom.*;
import mindustry.annotations.Annotations.*;
import mindustry.entities.units.*;
import mindustry.net.*;
public class EntityDefs{
@EntityDef({Health.class, Vel.class, Status.class, Connection.class})
class PlayerDef{}
class Health{
float health, maxHealth;
boolean dead;
float healthf(){
return health / maxHealth;
}
}
class Pos{
float x, y;
}
class Vel extends Pos{
Vec2 vel = new Vec2();
void update(){
x += vel.x;
y += vel.y;
vel.scl(0.9f);
}
}
class Status{
Statuses statuses = new Statuses();
void update(){
statuses.update(null);
}
}
class Connection{
NetConnection connection;
}
}