Files
CINC/systems/ControlMode.js
T
2025-12-31 00:30:38 +08:00

24 lines
489 B
JavaScript

export const CONTROL_MODE = {
SINGLE: 'single',
GROUP: 'group',
JOYSTICK: 'joystick'
};
export let activeUnit = null;
export let selectedUnits = [];
export function setActiveUnit(unit) {
activeUnit = unit;
// 不再重置selectedUnits数组,这样可以同时选中多个单位
}
export function addToSelection(unit) {
if (!selectedUnits.includes(unit)) {
selectedUnits.push(unit);
}
}
export function clearSelection() {
activeUnit = null;
selectedUnits = [];
}