void creat() { float x = transform.parent.parent.GetChild(1).GetComponent <roofcontrol>().twvalue; Vector3 xx = transform.parent.parent.GetChild(0).GetChild(0).GetChild(0).GetComponent <RidgeControl>().ridgemanage[0].transform.GetChild(2).transform.position - transform.parent.parent.GetChild(0).GetChild(0).GetChild(0).GetComponent <RidgeControl>().ridgemanage[1].transform.GetChild(2).transform.position; //tilelong = Vector3.Magnitude(xx / (x)); int ui = transform.parent.parent.GetChild(1).GetComponent <roofcontrol>().numberslidervalue; roofsurcontrol r2 = transform.parent.GetComponent <roofsurcontrol>(); circlecut1 cir = transform.GetComponent <circlecut1>(); midplanecut pla = transform.GetComponent <midplanecut>(); // cir.anchorpointlist GameObject neew = new GameObject(); neew.name = (this.name + "-tile"); neew.transform.parent = this.transform; for (int i = 0; i < pla.anchorpointlist.Count - 2; i++) { Vector3 ori = pla.anchorpointlist[i]; Vector3 letter = pla.anchorpointlist[i + 1]; Vector3 bottomline = new Vector3(ori.x - letter.x, 0, ori.z - letter.z); Vector3 slopeline = ori - letter; //Vector3.AngleBetween(bottomline, slopeline); float oo = Vector3.Angle(bottomline, slopeline); if (letter.y - ori.y < 0) { oo = -oo; } float zz = 0f; if (i == 0) { //GameObject haha = GameObject.Find("MIDroundtile-eave"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; GameObject bon = Instantiate(bonbon2, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.transform.parent = neew.transform; bon.transform.parent = neew.transform; int angle = r2.roofsurfacemanage.IndexOf(this.transform.gameObject); //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); */ int j = angle; /* * tile.transform.GetChild(2).transform.Rotate(-6, 0, 0); * tile.transform.GetChild(4).transform.Rotate(-6, 0, 0); * */ tile.transform.Rotate(oo, (90 + (360 / ui) / 2) + (360 / ui) * (j), -zz); bon.transform.Rotate(oo, (90 + (360 / ui) / 2) + (360 / ui) * (j), -zz); bon.transform.localScale = new Vector3(4, 4, tilelong2); bon.transform.Translate(0, -0, 0); bonbons.Add(bon); tile.transform.localScale = new Vector3(tilelong, 2, tilelong2); tileds.Add(tile); } else if (i == pla.anchorpointlist.Count - 3) { //GameObject haha1 = GameObject.Find("MIDroundtop"); GameObject tile = Instantiate(haha1, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.transform.parent = neew.transform; int angle = r2.roofsurfacemanage.IndexOf(this.transform.gameObject); //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); * */ int j = angle; tile.transform.GetChild(2).transform.Rotate(-6, 0, 0); tile.transform.GetChild(4).transform.Rotate(-6, 0, 0); tile.transform.Rotate(oo, (90 + (360 / ui) / 2) + (360 / ui) * (j), -zz); tile.transform.localScale = new Vector3(tilelong, 2, tilelong2); tileds.Add(tile); } else { // GameObject haha2 = GameObject.Find("MIDroundtile"); GameObject tile = Instantiate(haha2, (ori + letter) / 2, Quaternion.identity) as GameObject; GameObject bon = Instantiate(bonbon, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.transform.parent = neew.transform; bon.transform.parent = neew.transform; int angle = r2.roofsurfacemanage.IndexOf(this.transform.gameObject); //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); * */ int j = angle; tile.transform.GetChild(2).transform.Rotate(-6, 0, 0); tile.transform.GetChild(4).transform.Rotate(-6, 0, 0); tile.transform.Rotate(oo, (90 + (360 / ui) / 2) + (360 / ui) * (j), -zz); bon.transform.Rotate(oo, (90 + (360 / ui) / 2) + (360 / ui) * (j), -zz); bon.transform.localScale = new Vector3(4, 4, tilelong2); bon.transform.Translate(0, -0, 0); bonbons.Add(bon); tile.transform.localScale = new Vector3(tilelong, 2, tilelong2); tileds.Add(tile); } } }
// Update is called once per frame void Update() { if (gameObject.name == mice1.movenum && gameObject.transform.parent.name.Substring(0, 3) == mice1.movenumfa) { if (Input.GetMouseButton(0)) { if (transform.parent.name == "roofcurve1") { roofsurfacecontrol rf = GameObject.Find("Main Camera").GetComponent <roofsurfacecontrol>(); rf.reset(); } if (transform.parent.GetComponent <catline>()) { catline cat = transform.parent.GetComponent <catline>(); cat.ResetCatmullRom(); } if (transform.parent.GetComponent <circlecut1>()) { circlecut1 cir = transform.parent.GetComponent <circlecut1>(); cir.reset(); } if (transform.parent.GetComponent <planecut>()) { planecut pla = transform.parent.GetComponent <planecut>(); pla.reset(); } if (transform.parent.GetComponent <newtiled>()) { newtiled tie = transform.parent.GetComponent <newtiled>(); tie.reset(); } if (transform.parent.GetComponent <newtiledL>()) { newtiledL tie = transform.parent.GetComponent <newtiledL>(); tie.reset(); } } if (gameObject.transform.parent.name.Substring(0, 9) == "roofcurve") { Vector3 vect = Vector3.Normalize(GameObject.Find("roofcurve1").transform.GetChild(2).transform.position - GameObject.Find("roofcurve1").transform.GetChild(0).transform.position); transform.Translate(mice1.yy * vect.x, 0, mice1.yy * vect.z); transform.Translate(0, mice1.xx, 0); } else { Vector3 vect = Vector3.Normalize(transform.parent.GetChild(2).transform.position - transform.parent.GetChild(0).transform.position); //Vector3 vect2 = Vector3.Normalize(GameObject.Find("roofcurve" + int.Parse(gameObject.transform.parent.name.Substring(14, 1))).transform.GetChild(2).transform.position - GameObject.Find("roofcurve" + int.Parse(gameObject.transform.parent.name.Substring(14, 1))).transform.GetChild(0).transform.position); //float vv = vect.magnitude/vect2.magnitude; /* * transform.Translate(mice1.yy * vect.x, 0, mice1.yy * vect.z); * transform.Translate(0, mice1.xx, 0); */ if (transform.parent.name.Substring(13, 1) == "R") { /* * print(transform.parent.name.Substring(16, 1)); * print("rrrR"+int.Parse(transform.parent.name.Substring(14, 1))); */ transform.position = GameObject.Find("rrrR" + int.Parse(transform.parent.name.Substring(14, 1))).transform.GetChild((int.Parse(transform.parent.name.Substring(16, 1))) - 1).transform.position; } if (transform.parent.name.Substring(13, 1) == "L") { transform.position = GameObject.Find("rrrL" + int.Parse(transform.parent.name.Substring(14, 1))).transform.GetChild((int.Parse(transform.parent.name.Substring(16, 1))) - 1).transform.position; } /* * p.Set3Points(transform.parent.GetChild(0).transform.position, transform.parent.GetChild(1).transform.position, transform.parent.GetChild(2).transform.position); * Vector3 line = (GameObject.Find("Ridge" + int.Parse(gameObject.transform.parent.name.Substring(9, 1))).transform.GetChild(1).transform.position) - (GameObject.Find("roofcurve" + int.Parse(gameObject.transform.parent.name.Substring(9, 1))).transform.GetChild(2).transform.position); * * * p.Set3Points(transform.parent.GetChild(0).transform.position, transform.parent.GetChild(1).transform.position, transform.parent.GetChild(2).transform.position); * if (gameObject.transform.parent.name.Substring(13, 1) == "R") * { * * Vector3 line = (GameObject.Find("Ridge" + int.Parse(gameObject.transform.parent.name.Substring(9, 1))).transform.GetChild(1).transform.position) - (GameObject.Find("roofcurve" + int.Parse(gameObject.transform.parent.name.Substring(9, 1))).transform.GetChild(2).transform.position); * * } * else * { * * * * } */ } } }
public void creat() { int ui = transform.parent.parent.parent.GetChild(1).GetComponent <UIcontrol>().numberslidervalue; // int ui = GameObject.Find("Canvas").GetComponent<UIcontrol>().numberslidervalue; //RidgeControl r2 = this.transform.parent.GetChild(0).GetComponent<RidgeControl>(); circlecut1 pla = transform.GetComponent <circlecut1>(); //midplanecut pla = transform.GetComponent<midplanecut>(); // cir.anchorpointlist GameObject haha = GameObject.Find("cylinder"); //GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; for (int i = 0; i < pla.anchorpointlist.Count - 2; i++) { Vector3 ori = pla.anchorpointlist[i]; Vector3 letter = pla.anchorpointlist[i + 1]; Vector3 bottomline = new Vector3(ori.x - letter.x, 0, ori.z - letter.z); Vector3 slopeline = ori - letter; //Vector3.AngleBetween(bottomline, slopeline); float oo = 90f; float zz = 0f; if (i == 0) { GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); */ tile.transform.Rotate(oo, 0, 0); tile.transform.localScale = new Vector3(0.8f, 0.8f, 1.6f); tileds.Add(tile); } else if (i == pla.anchorpointlist.Count - 3) { GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); * */ tile.transform.Rotate(oo, 0, 0); tile.transform.localScale = new Vector3(0.8f, 0.8f, 1.6f); tileds.Add(tile); } else { GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); * */ tile.transform.Rotate(oo, 0, 0); tile.transform.localScale = new Vector3(0.8f, 0.8f, 1.6f); tileds.Add(tile); } } }
public void creat() { int ui = transform.parent.parent.parent.GetChild(1).GetComponent <roofcontrol>().numberslidervalue; RidgetailControl r2 = this.transform.parent.GetChild(0).GetComponent <RidgetailControl>(); circlecut1 pla = transform.GetComponent <circlecut1>(); int c1 = pla.anchorpointlist.Count / 9; for (int i = 0; i < pla.anchorpointlist.Count - 2; i++) { Vector3 ori = pla.anchorpointlist[i]; Vector3 letter = pla.anchorpointlist[i + 1]; Vector3 bottomline = new Vector3(ori.x - letter.x, 0, ori.z - letter.z); Vector3 slopeline = ori - letter; float oo = Vector3.Angle(bottomline, slopeline); if (letter.y - ori.y < 0) { oo = -oo; } float zz = 0f; if (i < c1 * 2) { GameObject haha = GameObject.Find("main_ridge"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; int angle = r2.ridgetailmanage.IndexOf(this.transform.gameObject); int y = i; int j = angle; tile.transform.Rotate(oo, -90 + (360 / ui) * (j), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } else if (i >= c1 * 5) { GameObject haha = GameObject.Find("main_ridge3"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; int angle = r2.ridgetailmanage.IndexOf(this.transform.gameObject); int y = i; int j = angle; tile.transform.Rotate(oo, -90 + (360 / ui) * (j), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } else if (i >= c1 * 2) { GameObject haha = GameObject.Find("main_ridge2"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; int angle = r2.ridgetailmanage.IndexOf(this.transform.gameObject); int y = i; int j = angle; tile.transform.Rotate(oo, -90 + (360 / ui) * (j), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } } }
public void creat() { //int ui = GameObject.Find("Canvas").GetComponent<UIcontrol>().numberslidervalue; int ui = transform.parent.parent.GetChild(1).GetComponent <roofcontrol>().numberslidervalue;; upridge r2 = this.transform.parent.GetComponent <upridge>(); circlecut1 pla = transform.GetComponent <circlecut1>(); //midplanecut pla = transform.GetComponent<midplanecut>(); // cir.anchorpointlist for (int i = 0; i < pla.anchorpointlist.Count - 2; i++) { Vector3 ori = pla.anchorpointlist[i]; Vector3 letter = pla.anchorpointlist[i + 1]; Vector3 bottomline = new Vector3(ori.x - letter.x, 0, ori.z - letter.z); Vector3 slopeline = ori - letter; //Vector3.AngleBetween(bottomline, slopeline); float oo = Vector3.Angle(bottomline, slopeline); if (letter.y - ori.y < 0) { oo = -oo; } float zz = 0f; if (i == 0) { GameObject haha = GameObject.Find("main_ridge"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; int angle = r2.upridgemanage.IndexOf(this.transform.gameObject); //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); */ int j = angle; /* * tile.transform.GetChild(2).transform.Rotate(-6, 0, 0); * tile.transform.GetChild(4).transform.Rotate(-6, 0, 0); * */ tile.transform.Rotate(oo, ((180 / ui) - 180) + ((360 / ui) * j), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } else if (i == pla.anchorpointlist.Count - 3) { GameObject haha = GameObject.Find("main_ridge"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; int angle = r2.upridgemanage.IndexOf(this.transform.gameObject); //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); * */ int j = angle; tile.transform.Rotate(oo, ((180 / ui) - 180) + ((360 / ui) * j), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } else { GameObject haha = GameObject.Find("main_ridge"); GameObject tile = Instantiate(haha, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.tag = ("PIG"); tile.transform.parent = this.transform; int angle = r2.upridgemanage.IndexOf(this.transform.gameObject); //int x = int.Parse(neew.transform.name.Substring(16, 1)); int y = i; /* * Vector3 zr = plane.sloslopR[x + 1, y] - plane.sloslopR[x, y]; * Vector3 zrp = new Vector3(plane.sloslopR[x + 1, y].x - plane.sloslopR[x, y].x, 0, plane.sloslopR[x + 1, y].z - plane.sloslopR[x, y].z); * zz = Vector3.Angle(zr, zrp); * */ int j = angle; tile.transform.Rotate(oo, ((180 / ui) - 180) + ((360 / ui) * j), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } } }
public void creat() { /* * print(this.transform.GetChild(0).name); * print(this.transform.GetChild(transform.childCount - 1).name); */ Vector3 up = this.transform.GetChild(0).transform.position; //Vector3 down = this.transform.GetChild(transform.childCount - 1).transform.position; Vector3 down = this.transform.GetChild(transform.childCount - 1).transform.position; Vector3 NowRight = new Vector3(down.x - up.x, 0, down.z - up.z); haha(NowRight); circlecut1 pla = transform.GetComponent <circlecut1>(); for (int i = 0; i < pla.anchorpointlist.Count - 2; i++) { Vector3 ori = pla.anchorpointlist[i]; Vector3 letter = pla.anchorpointlist[i + 1]; Vector3 bottomline = new Vector3(ori.x - letter.x, 0, ori.z - letter.z); Vector3 slopeline = ori - letter; float oo = Vector3.Angle(bottomline, slopeline); if (letter.y - ori.y < 0) { oo = -oo; } float zz = 0f; if (i == 0) { GameObject tile = Instantiate(mridge, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.transform.parent = this.transform; int y = i; tile.transform.Rotate(oo, haha(NowRight), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } else if (i == pla.anchorpointlist.Count - 3) { GameObject tile = Instantiate(mridge, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.transform.parent = this.transform; int y = i; tile.transform.Rotate(oo, haha(NowRight), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } else { GameObject tile = Instantiate(mridge, (ori + letter) / 2, Quaternion.identity) as GameObject; tile.transform.parent = this.transform; int y = i; tile.transform.Rotate(oo, haha(NowRight), 0); tile.transform.localScale = new Vector3(tilelong, 0.02f, tilelong2); tileds.Add(tile); } } }