feat(control) 小地图

This commit is contained in:
chicrobot committed 2025-12-31 00:30:38 +08:00
1 parent f86e5f3a79
commit e2bc630d6d
8 files changed
+339 -24

No files matched your search

+10 -4
View File
@@ -11,14 +11,20 @@ export class CommandSystem {
}
onMoveRelative(dir) {
if (activeUnit) {
activeUnit.moveRelative(dir.x, dir.y);
}
const targets = selectedUnits.length > 0 ? selectedUnits : (activeUnit ? [activeUnit] : []);
targets.forEach(unit => {
unit.moveRelative(dir.x, dir.y);
});
}
onMoveToPoint(x, y) {
const targets = selectedUnits.length > 0 ? selectedUnits : (activeUnit ? [activeUnit] : []);
targets.forEach(unit => unit.moveTo(x, y));
targets.forEach(unit => {
unit.setTarget(x, y); // ← 使用新接口
});
}
onSelectUnit(unit) {