Optimizations
This commit is contained in:
@@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,4 +10,8 @@ public interface UnitController{
|
||||
default void command(UnitCommand command){
|
||||
|
||||
}
|
||||
|
||||
default void update(){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user