protected override void DoUpdate() { // Alt button VRInput.ButtonEvent(VRInput.primaryController, CommonUsages.primaryButton, () => { previousColorOp = colorOp; colorOp = ColorOp.Pick; uiInitialized = false; }, () => { colorOp = previousColorOp; uiInitialized = false; }); // Update UI if (!uiInitialized) { uiInitialized = true; switch (colorOp) { case ColorOp.Colorize: OnSetColorize(); break; case ColorOp.UpdateSelection: OnSetUpdateSelection(); break; case ColorOp.Pick: OnSetPick(); break; } UpdatePreview(); } // Clear selection: only when triggering on nothing with the ColorOp.UpdateSelection if (ColorOp.UpdateSelection == colorOp) { VRInput.ButtonEvent(VRInput.primaryController, CommonUsages.triggerButton, () => { selectionHasChanged = false; }, () => { if (!selectionHasChanged && ColorOp.UpdateSelection == colorOp) { CommandRemoveFromSelection command = new CommandRemoveFromSelection(Selection.SelectedObjects.ToList()); command.Redo(); command.Submit(); } }); } }
private void SelectObjects(List <GameObject> gobjects) { bool primaryState = VRInput.GetValue(VRInput.primaryController, CommonUsages.primaryButton); ICommand command; if (!primaryState) { command = new CommandAddToSelection(gobjects); } else { command = new CommandRemoveFromSelection(gobjects); } command.Redo(); command.Submit(); selectionHasChanged = true; }