mirror of
https://github.com/MartinKral/Slash-The-Hordes
synced 2025-04-21 22:38:52 +00:00
13 lines
450 B
TypeScript
13 lines
450 B
TypeScript
import { Vec3 } from "cc";
|
|
import { EnemyMover } from "./EnemyMover";
|
|
|
|
export class FollowTargetEnemyMover extends EnemyMover {
|
|
public gameTick(deltaTime: number): void {
|
|
this.enemies.forEach((enemy) => {
|
|
let direction: Vec3 = new Vec3();
|
|
direction = Vec3.subtract(direction, this.targetNode.worldPosition, enemy.node.worldPosition);
|
|
enemy.moveBy(direction.normalize(), deltaTime);
|
|
});
|
|
}
|
|
}
|