Optimizations

This commit is contained in:
Anuken
2020-02-10 11:07:10 -05:00
parent 6c6861a97a
commit 81990cf16c
4 changed files with 29 additions and 7 deletions

View File

@@ -1,10 +1,14 @@
package mindustry.entities.units;
import arc.math.*;
import arc.util.*;
import mindustry.gen.*;
public class AIController implements UnitController{
protected Unitc unit;
float rot = Mathf.random(360f);
@Override
public void unit(Unitc unit){
this.unit = unit;
@@ -15,5 +19,13 @@ public class AIController implements UnitController{
return unit;
}
@Override
public void update(){
rot += Mathf.range(3f) * Time.delta();
unit.moveAt(Tmp.v1.trns(rot, unit.type().speed));
if(!unit.vel().isZero()){
unit.lookAt(unit.vel().angle());
}
}
}

View File

@@ -10,4 +10,8 @@ public interface UnitController{
default void command(UnitCommand command){
}
default void update(){
}
}