Overdrive system
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user