Files
CINC/systems/ControlMode.js
T

24 lines
451 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 = unit ? [unit] : [];
}
export function addToSelection(unit) {
if (!selectedUnits.includes(unit)) {
selectedUnits.push(unit);
}
}
export function clearSelection() {
activeUnit = null;
selectedUnits = [];
}