Overdrive system

This commit is contained in:
Anuken
2018-09-07 17:16:38 -04:00
parent e4ce115abf
commit d046591512
26 changed files with 136 additions and 85 deletions
@@ -40,9 +40,11 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
private static final ObjectSet<Tile> tmpTiles = new ObjectSet<>();
/**This value is only used for debugging.*/
public static int sleepingEntities = 0;
public Tile tile;
public Timer timer;
public float health;
public float timeScale = 1f, timeScaleDuration;
public PowerModule power;
public InventoryModule items;
@@ -85,6 +87,11 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
return this;
}
/**Scaled delta.*/
public float delta(){
return Timers.delta() * timeScale;
}
/**Call when nothing is happening to the entity. This increments the internal sleep timer.*/
public void sleep(){
sleepTime += Timers.delta();
@@ -252,6 +259,11 @@ public class TileEntity extends BaseEntity implements TargetTrait, HealthTrait{
Effects.effect(Fx.smoke, x + Mathf.range(4), y + Mathf.range(4));
}
timeScaleDuration -= Timers.delta();
if(timeScaleDuration <= 0f){
timeScale = 1f;
}
if(health <= 0){
onDeath();
}