public void OnDrag() { transform.position = Input.mousePosition + mouseDiff; //一番近いFrameがRadius以下の距離にあれば選択、過去のものは破棄 FrameController to = frameManager.Frames.Where(x => x.IsSelectable) .OrderBy(x => Vector3.Distance(x.transform.position, transform.position)).FirstOrDefault(); float distPos = Vector3.Distance(to.transform.position, transform.position); if (distPos < manager.Radius && to != toFrame) { to.Select(); if (toFrame != null) { toFrame.UnSelect(); } toFrame = to; } else if (distPos >= manager.Radius) { if (toFrame != null) { toFrame.UnSelect(); } toFrame = null; } }
public void OnDown() { mouseDiff = transform.position - Input.mousePosition; transform.SetAsLastSibling(); if (toFrame != null) { toFrame.ResetPanel(); toFrame.Select(); } }