public static void AvoidOverlap(RectTransform _origin) { RectTransform nearestTransform = DelegateManager.GetNearestUIObject(allUIObjects, minDistance, _origin); RandomizePosition(_origin); if (nearestTransform != null && nearestTransform != _origin) { //Debug.Log(nearestTransform.name.ToString()); float newX = _origin.anchoredPosition.x - (_origin.anchoredPosition.x - nearestTransform.anchoredPosition.x > 0 ? minDistance : minDistance); float newY = _origin.anchoredPosition.y - (_origin.anchoredPosition.y - nearestTransform.anchoredPosition.y > 0 ? minDistance : minDistance); _origin.anchoredPosition = new Vector3(newX, newY); AvoidOverlap(_origin); } }
public static void AvoidOverlap(ThingRuntimeSet _thingRuntimeSet, float _detectionRadius, RectTransform _origin) { RectTransform nearestTransform = DelegateManager.GetNearestUIObject(_thingRuntimeSet, _detectionRadius, _origin); RandomizePosition(_origin); if (nearestTransform != null && nearestTransform != _origin) { //Debug.Log(nearestTransform.name.ToString()); float newX = _origin.anchoredPosition.x - (_origin.anchoredPosition.x - nearestTransform.anchoredPosition.x > 0 ? _detectionRadius : _detectionRadius); float newY = _origin.anchoredPosition.y - (_origin.anchoredPosition.y - nearestTransform.anchoredPosition.y > 0 ? _detectionRadius : _detectionRadius); _origin.anchoredPosition = new Vector3(newX, newY); AvoidOverlap(_thingRuntimeSet, _detectionRadius, _origin); } }
public void Check(Ray ray) { if (Physics.Raycast(ray, out RaycastHit hit)) { Transform selection = hit.transform; if (selection.tag == selectableTag) { DelegateManager.currentHoverSelection = selection; DelegateManager.OnHover(selection); } else { DelegateManager.currentHoverSelection = null; DelegateManager.stopHover(); } } }
private void OnLMB_Up() { CheckDoubleClick(); foreach (Draggable draggedItem in draggedItems) { if (draggedItem == null) { continue; } if (!draggedItem.Drop()) { DelegateManager.OnClickSelect(_currentClickSelection); } } draggedItems.Clear(); _currentClickSelection = null; }