Files
pixelheros/assets/script/game/component/hero/Movement.ts
walkpan bffbb9077e dd
2025-02-01 00:14:25 +08:00

19 lines
496 B
TypeScript

import { ecs } from "../../../../../extensions/oops-plugin-framework/assets/libs/ecs/ECS";
import { Vec3 } from "cc";
/** 移动组件 */
@ecs.register('Movement')
export class Movement extends ecs.Comp {
/** 移动速度(像素/秒) */
speed: number = 200;
/** 目标位置 */
target: Vec3 = new Vec3();
/** 当前移动方向 */
direction: Vec3 = new Vec3();
reset() {
this.speed = 200;
this.target.set();
this.direction.set();
}
}