// Update is called once per frame void Update() { if (AppMgr.pts == null) { return; } if (parent != null) { parent.SetActive(Active); } if (Point1 != null && Point2 != null) { Vec0 = Point1.GetComponent <Point>().transform.position; vec0.z = 0.0f; Vec1 = Point2.GetComponent <Point>().transform.position; vec1.z = 0.0f; } else { Point1 = Point2 = null; GameObject[] OBJs = FindObjectsOfType <GameObject>(); for (int i = 0; i < OBJs.Length; i++) { Point PT = OBJs[i].GetComponent <Point>(); if (PT != null) { if (PT.Id == Point1Id) { Point1 = OBJs[i]; } if (PT.Id == Point2Id) { Point2 = OBJs[i]; } } } if (Point1 == null) { Point1Id = -1; Active = false; } if (Point2 == null) { Point2Id = -1; Active = false; } } lr.SetPosition(0, Vec0); lr.SetPosition(1, Vec1); Renderer rd = GetComponent <Renderer>(); if (Selected) { if (Isometry >= 0) { rd.material.color = Util.IsometrySelectedColor[Isometry % 10]; } else { rd.material.color = SelectedColor; } } else { if (Isometry >= 0) { rd.material.color = Util.IsometryColor[Isometry % 10]; } else { rd.material.color = StandardColor; } } }
// Update is called once per frame void Update() { //if (AppMgr.pts == null) return; //if (AppMgr.lns == null) return; gameObject.SetActive(Active); ///Debug.Log(PointId); if (Point1 != null && Point2 != null && Point3 != null) { Vec1 = Point1.GetComponent <Point>().transform.position; Vec1.z = 0.0f; Vec2 = Point2.GetComponent <Point>().transform.position; Vec2.z = 0.0f; Vec3 = Point3.GetComponent <Point>().transform.position; Vec3.z = 0.0f; } else { GameObject[] OBJs = FindObjectsOfType <GameObject>(); GameObject LineObj = null; Line LN = null; for (int i = 0; i < OBJs.Length; i++) { LN = OBJs[i].GetComponent <Line>(); if (LN != null) { if (LN.Id == LineId) { LineObj = OBJs[i]; break; } } } if (LineObj == null) { Active = false; LineId = -1; } else { Point1 = Point2 = Point3 = null; for (int i = 0; i < OBJs.Length; i++) { Point PT = OBJs[i].GetComponent <Point>(); if (PT != null) { if (PT.Id == PointId) { Point2 = OBJs[i]; Vec2 = PT.transform.position; Vec2.z = 0.0f; } if (PT.Id == LN.Point1Id) { Point1 = OBJs[i]; Vec1 = PT.transform.position; Vec1.z = 0.0f; } if (PT.Id == LN.Point2Id) { Point3 = OBJs[i]; Vec3 = PT.transform.position; Vec3.z = 0.0f; } } } if (Point1 == null || Point2 == null || Point3 == null) { Active = false; } } } LR = GetComponent <LineRenderer>(); LR.SetPosition(0, Vec1); LR.SetPosition(1, Vec2); LR.SetPosition(2, Vec3); Renderer RD = GetComponent <LineRenderer>(); RD.material.color = StandardColor; }