39 lines
909 B
TypeScript
39 lines
909 B
TypeScript
![]() |
import { RobotStatus } from "./robotstatus";
|
||
|
import { RoboBase } from "./robobase";
|
||
|
|
||
|
class TargetPractice extends RoboBase {
|
||
|
lastHealth = 100;
|
||
|
ready() {
|
||
|
console.log("targetPractice is ready");
|
||
|
this.cmd.radarMin = -1;
|
||
|
this.cmd.radarMax = -1;
|
||
|
this.cmd.gunTarget = 0;
|
||
|
this.sendCmd();
|
||
|
}
|
||
|
start() {
|
||
|
console.log("simulation started");
|
||
|
this.cmd.radarMin = -1;
|
||
|
this.cmd.radarMax = -1;
|
||
|
this.sendCmd();
|
||
|
}
|
||
|
statusReady(status: RobotStatus) {
|
||
|
if (status.health != this.lastHealth) {
|
||
|
console.log("got hit life left:", status.health);
|
||
|
this.lastHealth = status.health;
|
||
|
}
|
||
|
// no actions, no send
|
||
|
// this.sendCmd();
|
||
|
}
|
||
|
lost() {
|
||
|
console.log("we lost");
|
||
|
this.disconnect();
|
||
|
}
|
||
|
won() {
|
||
|
console.log("we won, how?");
|
||
|
this.disconnect();
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
var targetPractice = new TargetPractice("targetPractice", "scout");
|
||
|
targetPractice.connect();
|