Time.delta cleanup / Basic mobile input
This commit is contained in:
@@ -181,7 +181,7 @@ public class BlockIndexer{
|
||||
for(int y = -tileRange + ty; y <= tileRange + ty; y++){
|
||||
if(!Mathf.within(x * tilesize, y * tilesize, wx, wy, range)) continue;
|
||||
|
||||
Building other = world.ent(x, y);
|
||||
Building other = world.build(x, y);
|
||||
|
||||
if(other == null) continue;
|
||||
|
||||
@@ -247,7 +247,7 @@ public class BlockIndexer{
|
||||
|
||||
for(int tx = rx * quadrantSize; tx < (rx + 1) * quadrantSize && tx < world.width(); tx++){
|
||||
for(int ty = ry * quadrantSize; ty < (ry + 1) * quadrantSize && ty < world.height(); ty++){
|
||||
Building e = world.ent(tx, ty);
|
||||
Building e = world.build(tx, ty);
|
||||
|
||||
if(e == null) continue;
|
||||
|
||||
@@ -388,7 +388,7 @@ public class BlockIndexer{
|
||||
outer:
|
||||
for(int x = quadrantX * quadrantSize; x < world.width() && x < (quadrantX + 1) * quadrantSize; x++){
|
||||
for(int y = quadrantY * quadrantSize; y < world.height() && y < (quadrantY + 1) * quadrantSize; y++){
|
||||
Building result = world.ent(x, y);
|
||||
Building result = world.build(x, y);
|
||||
//when a targetable block is found, mark this quadrant as occupied and stop searching
|
||||
if(result != null && result.team() == team){
|
||||
bits.set(quadrantX, quadrantY);
|
||||
|
||||
@@ -167,12 +167,12 @@ public class Pathfinder implements Runnable{
|
||||
}
|
||||
}
|
||||
|
||||
public Tile getTargetTile(Tile tile, Team team, Position target){
|
||||
public @Nullable Tile getTargetTile(Tile tile, Team team, Position target){
|
||||
return getTargetTile(tile, team, getTarget(target));
|
||||
}
|
||||
|
||||
/** Gets next tile to travel to. Main thread only. */
|
||||
public Tile getTargetTile(Tile tile, Team team, PathTarget target){
|
||||
public @Nullable Tile getTargetTile(Tile tile, Team team, PathTarget target){
|
||||
if(tile == null) return null;
|
||||
|
||||
if(fieldMap[team.id] == null){
|
||||
|
||||
@@ -69,7 +69,7 @@ public class BuilderAI extends AIController{
|
||||
|
||||
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / 100f, -1f, 1f);
|
||||
|
||||
vec.setLength(unit.type().speed * Time.delta() * length);
|
||||
vec.setLength(unit.type().speed * Time.delta * length);
|
||||
if(length < -0.5f){
|
||||
vec.rotate(180f);
|
||||
}else if(length < 0){
|
||||
|
||||
@@ -61,7 +61,7 @@ public class FlyingAI extends AIController{
|
||||
vec.rotate((circleLength - vec.len()) / circleLength * 180f);
|
||||
}
|
||||
|
||||
vec.setLength(speed * Time.delta());
|
||||
vec.setLength(speed * Time.delta);
|
||||
|
||||
unit.moveAt(vec);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ public class FlyingAI extends AIController{
|
||||
|
||||
float length = circleLength <= 0.001f ? 1f : Mathf.clamp((unit.dst(target) - circleLength) / 100f, -1f, 1f);
|
||||
|
||||
vec.setLength(unit.type().speed * Time.delta() * length);
|
||||
vec.setLength(unit.type().speed * Time.delta * length);
|
||||
if(length < -0.5f){
|
||||
vec.rotate(180f);
|
||||
}else if(length < 0){
|
||||
@@ -95,7 +95,7 @@ public class FlyingAI extends AIController{
|
||||
vec.setAngle(Mathf.slerpDelta(unit.vel().angle(), vec.angle(), 0.6f));
|
||||
}
|
||||
|
||||
vec.setLength(unit.type().speed * Time.delta());
|
||||
vec.setLength(unit.type().speed * Time.delta);
|
||||
|
||||
unit.moveAt(vec);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user