private void HandleConnectPointConnected(ConnectPoint connectPt, Connectable connectable) { connectable.transform.SetParent(transform, true); connectable.GetComponent <Damagable>().OnPartDestroyed.AddListener(HandleConnectedPartDestroyed); Ship.RegisterConnectable(connectable); ConnectedPart = connectable; }
public void OnBeginDrag(PointerEventData eventData) { GameObject obj = new GameObject("anchor", new System.Type[] { typeof(RectTransform) }); tempConnectable = obj.AddComponent <Connectable>(); GetComponentInParent <Node>().next = tempConnectable; tempConnectable.anchor = tempConnectable.transform; tempConnectable.transform.SetParent(transform, true); tempConnectable.GetComponent <RectTransform>().anchoredPosition = Vector2.zero; // tempConnectable.GetComponent<RectTransform>().anchoredPosition = RectTransformExtension.switchToRectTransform(GetComponent<RectTransform>(), tempConnectable.GetComponent<RectTransform>()); }
public void OnDrag(PointerEventData eventData) { tempConnectable.GetComponent <RectTransform>().anchoredPosition += eventData.delta; }