private void SetupGizmo(SrGizmo srGizmo, bool enableGizmo) { if (_selectedObject != null && enableGizmo) { SetGizmoPosition(srGizmo); srGizmo.gameObject.SetActive(true); } else { srGizmo.gameObject.SetActive(false); _selectedGizmoType = SrGizmoType.None; } }
private void SelectObject() { var ray = Camera.ScreenPointToRay(Input.mousePosition); var hit = Physics.Raycast(ray, out var hitInfo); if (hit && hitInfo.transform.GetComponent <SrGizmoAxis>() == null) { _selectedObject = hitInfo.collider.gameObject; return; } _selectedObject = null; _selectedGizmoType = SrGizmoType.None; }
private void SelectNextGizmo() { while (_currentGizmoIndex < Gizmos.Length) { _currentGizmoIndex++; if (_currentGizmoIndex >= Gizmos.Length) { _currentGizmoIndex = 0; } SetupGizmo(_currentGizmoIndex - 1 >= 0 ? Gizmos[_currentGizmoIndex - 1] : Gizmos[Gizmos.Length - 1], false); if (IsFullyRestricted(Gizmos[_currentGizmoIndex])) { continue; } SetupGizmo(Gizmos[_currentGizmoIndex], true); _selectedGizmoType = Gizmos[_currentGizmoIndex].GizmoType; break; } }