mirror of
http://junepve.top:3000/chicrobot/CINC.git
synced 2026-10-30 03:11:29 +08:00
feat(item) 优化移动及添加测试场景
This commit is contained in:
1 parent
2f7210f47e
commit
b9a5180293
15 files changed
+1428
-62
No files matched your search
@@ -26,7 +26,10 @@ export class CommandSystem {
|
||||
|
||||
// 遍历所有目标单位,调用它们的moveRelative方法进行相对移动
|
||||
targets.forEach(unit => {
|
||||
unit.moveRelative(dir.x, dir.y);
|
||||
// 确保unit是有效的Unit实例
|
||||
if (unit && typeof unit.moveRelative === 'function') {
|
||||
unit.moveRelative(dir.x, dir.y);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -37,7 +40,10 @@ export class CommandSystem {
|
||||
|
||||
// 遍历所有目标单位,调用它们的setTarget方法设置移动目标点
|
||||
targets.forEach(unit => {
|
||||
unit.setTarget(x, y); // ← 使用单位的新接口方法
|
||||
// 确保unit是有效的Unit实例
|
||||
if (unit && typeof unit.setTarget === 'function') {
|
||||
unit.setTarget(x, y); // ← 使用单位的新接口方法
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user