Docs
This commit is contained in:
@@ -1,31 +1,31 @@
|
||||
package mindustry.ai.types;
|
||||
|
||||
import arc.util.ArcAnnotate.*;
|
||||
import arc.util.*;
|
||||
import mindustry.entities.units.*;
|
||||
import mindustry.gen.*;
|
||||
|
||||
public class MimicAI extends AIController{
|
||||
public class FormationAI extends AIController{
|
||||
public @Nullable Unitc control;
|
||||
|
||||
public MimicAI(@Nullable Unitc control){
|
||||
public FormationAI(@Nullable Unitc control){
|
||||
this.control = control;
|
||||
}
|
||||
|
||||
public MimicAI(){
|
||||
public FormationAI(){
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update(){
|
||||
if(control != null){
|
||||
|
||||
unit.controlWeapons(control.isRotate(), control.isShooting());
|
||||
//TODO this isn't accurate
|
||||
unit.moveAt(Tmp.v1.set(control.vel()).limit(unit.type().speed));
|
||||
// unit.moveAt(Tmp.v1.set(deltaX, deltaY).limit(unit.type().speed));
|
||||
if(control.isShooting()){
|
||||
unit.aimLook(control.aimX(), control.aimY());
|
||||
}else{
|
||||
unit.lookAt(unit.vel().angle());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,8 @@ public class PhysicsProcess implements AsyncProcess{
|
||||
//save last position
|
||||
ref.position.set(entity);
|
||||
|
||||
entity.vel().add(ref.velocity).sub(ref.lastVelocity);
|
||||
//add delta velocity - this doesn't work very well yet
|
||||
//entity.vel().add(ref.velocity).sub(ref.lastVelocity);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -186,7 +186,7 @@ public class DesktopInput extends InputHandler{
|
||||
Fx.commandSend.at(player);
|
||||
Units.nearby(player.team(), player.x(), player.y(), 200f, u -> {
|
||||
if(u.isAI()){
|
||||
u.controller(new MimicAI(player.unit()));
|
||||
u.controller(new FormationAI(player.unit()));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user