void DestroylineDrag() { if(hasPlane) Destroy (GameObject.Find(GameControl.GameControlInstance.getPlaneName(changeDragPoint(DragNailName)))); Is_drag = false; //fuyuan if (points.Count == 1) { destroyDragLine(); MLine lineOri=new MLine(link1,link2,link1.transform); lineOri.setColor(GameControl.getColor); lineOri.obj.AddComponent<LinePoints> ().setLinePoint (link1.name,link2.name); } //add links if (points.Count == 2) { points[1].GetComponent<Renderer>().material.color=Color.red; if(points[1].GetComponent<AddNailPoint>()==null) points[1].AddComponent<AddNailPoint>(); // GameControl.nailControl.mPoints.Remove(GameControl.mLinks); //// GameControl.nailControl.mColor.Remove(GameControl.getColor); GameControl.nailControl.mPoints.RemoveAt(getNailIndex); GameControl.nailControl.mColor.RemoveAt(getNailIndex); for(int i=1;i<GameControl.mLinks.Length();i++) { if(GameControl.mLinks.get_Listnode(i).Equals(link1.name)&&GameControl.mLinks.get_Listnode(i+1).Equals(link2.name)) { GameControl.mLinks.Insert(i,points[1].name); } } GameControl.nailControl.mPoints.Add(GameControl.mLinks); GameControl.nailControl.mColor.Add(GameControl.getColor); } GameControl.GameControlInstance.setNailing (); lineIndexs.Clear (); pointLinks.Clear (); Destroy(GameObject.Find("dragObj")); Destroy (line); points.Clear (); // GameControl.mLinks = new VectorList.LinkList (); GameControl.mLinks = GameControl.nailControl.mPoints[GameControl.nailControl.mPoints.Count-1]; }
public void drawDragLine() { destroyDragLine (); if (points.Count == 1) { MLine line1 = new MLine (link1, points[0], link1.transform); line1.setColor(GameControl.getColor); MLine line2 = new MLine ( points[0],link2, points[0].transform); line2.setColor(GameControl.getColor); } if (points.Count == 2) { MLine line1 = new MLine (link1, points[1], link1.transform); line1.setColor(GameControl.getColor); line1.obj.AddComponent<LinePoints> ().setLinePoint (link1.name, points [1].name); MLine line2 = new MLine (points[1],link2, link2.transform); line2.setColor(GameControl.getColor); line2.obj.AddComponent<LinePoints> ().setLinePoint (points [1].name,link2.name ); } temp1 = 0; temp2 = 0; }
protected void setFirstLine(GameObject _point1,GameObject _point2) { setColor (); MLine line1 = new MLine (_point1,_point2, _point1.transform); line1.setColor (GameControl.getColor); MLine line2 = new MLine (_point2,_point1, _point2.transform); line2.setColor (GameControl.getColor); addCompent (_point1); addCompent (_point2); line1.obj.AddComponent<LinePoints> ().setLinePoint (_point1.name, _point2.name); line2.obj.AddComponent<LinePoints> ().setLinePoint (_point2.name, _point1.name); GameControl.mLines=new List<Line> (); GameControl.mLinks=new LinkList(); GameControl.GameControlInstance.addLinePoint (_point1.name, _point2.name); GameControl.GameControlInstance.addLinePoint (_point2.name, _point1.name); GameControl.mLinks.Insert (0,_point1.name); GameControl.mLinks.Insert (1,_point2.name); GameControl.mLinks.Insert (2,_point1.name); GameControl.nailControl.mPoints.Add (GameControl.mLinks); GameControl.nailControl.mColor.Add (GameControl.getColor); GameControl.GameControlInstance.setNailing (); }