private void OpenColorMenu() { SelectionFilter selectionFilter = selectionGizmo.selectionFilter; GameController.CursorFocusUI(true); if (!selectionFilter.IsMultiSelection) { fillColor = selectionFilter.GetSelectedGameObjects()[0].GetComponent <ChildScript>().GetColor(); } ColorPicker.Create(this.fillColor, "colortool", selectedColor => { if (!selectionFilter.IsMultiSelection) { selectionFilter.GetSelectedGameObjects()[0].GetComponent <ChildScript>().SetColor(selectedColor); } }, selectedColor => { if (fillColor == selectedColor) { return; } fillColor = selectedColor; foreach (GameObject selectedGameObject in selectionFilter.GetSelectedGameObjects()) { if (selectedGameObject.TryGetComponent <ChildScript>(out var component)) { component.SetColor(selectedColor); } }
private void RotateObject(Vector3Int rotation) { var pivot = moveGizmo.transform.position; var rotation90 = Vector3Int.RoundToInt((Vector3)rotation / 90f) * 90; var rotationDelta = rotation90 - lastRotation; if (rotationDelta != Vector3Int.zero) { SelectionFilter selectionFilter = selectionGizmo.selectionFilter; List <GameObject> gameObjects = selectionFilter.GetSelectedGameObjects(); selectionGizmo.selectionFilter = SelectionFilter.FromGameObjects(gameObjects, Vector3Int.RoundToInt(((Vector3)selectionFilter.min).Rotate(rotationDelta, pivot)), Vector3Int.RoundToInt(((Vector3)selectionFilter.max).Rotate(rotationDelta, pivot))); foreach (GameObject gameObject in gameObjects) { gameObject.transform.RotateAround(pivot, ((Vector3)rotationDelta).normalized, rotationDelta.magnitude); } } lastRotation = rotation90; }