feat(control) 多角色控制

This commit is contained in:
chicrobot committed 2025-12-30 21:45:25 +08:00
1 parent be5ee91328
commit f86e5f3a79
11 files changed
+431

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
export const CONTROL_MODE = {
SINGLE: 'single',
GROUP: 'group',
JOYSTICK: 'joystick'
};
export let activeUnit = null;
export let selectedUnits = [];
export function setActiveUnit(unit) {
activeUnit = unit;
selectedUnits = unit ? [unit] : [];
}
export function addToSelection(unit) {
if (!selectedUnits.includes(unit)) {
selectedUnits.push(unit);
}
}
export function clearSelection() {
activeUnit = null;
selectedUnits = [];
}