void Update() { isClicked = false; foreach (PointReference pr in pointRef) { if (pr.mb != null && pr.referenceIndex < points.Count) { Vector3 newPosition = pr.mb.transform.position - transform.position + pr.offset; if (((Vector3)points[pr.referenceIndex] - (newPosition)).magnitude > 0.01f) { SetAllDirty(); points[pr.referenceIndex] = newPosition + offsetMe; } } } if (linkedLink != null && (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))) { int isClickedInt = 0; for (int i = 0; i < myMesh.Count; i++) { isClickedInt = Clipper.PointInPolygon(new IntPoint((Input.mousePosition.x - transform.position.x) * clipperPrecision, (Input.mousePosition.y - transform.position.y) * clipperPrecision), myMesh[i]); if (isClickedInt != 0) { isClicked = true; // if( Input.GetMouseButtonDown(0) ) // { OnClicked(); // } if (Input.GetMouseButtonDown(1)) { mcmm.UpdateRightClickMenuWithLink(this); } break; } } } if (linkedLink != null) { if (linkedLink.GetLinkType() == LinkTypes.Data) { color = Color.blue; } else { color = Color.green; } } if (deleteOnNoSource) { if (linkedLink == null || linkedLink.source == null || linkedLink.destination == null) { Delete(); } } }
public void UpdateWithCreatedLink(MagicCircleLinks mcl) { GameObject obj = (GameObject)Instantiate(uiLinkPrefab, UiBoard); UILineRender uiLine = obj.GetComponent <UILineRender>(); uiLine.linkedLink = mcl; uiLine.mcmm = this; uiLine.points.Clear(); Vector3 offset = (mcl.GetLinkType() == LinkTypes.Transition ? Vector3.up * 5f : Vector3.zero); for (int i = 0; i < uiSpellNodeList.Count; i++) { if (uiSpellNodeList[i].linkedSpellNode == mcl.source) { uiLine.AddReference(uiSpellNodeList[i], offset); break; } } for (int i = 0; i < uiSpellNodeList.Count; i++) { if (uiSpellNodeList[i].linkedSpellNode == mcl.destination) { uiLine.AddReference(uiSpellNodeList[i], offset); break; } } // uiLine.AddReference( selectedUISN ); uiLinkList.Add(uiLine); uiLine.deleteOnNoSource = true; }