using UnityEngine; using System.Globalization; using UnityEngine.Rendering; using System.Collections.Generic; using TMPro; using UnityEngine.UI; public class Reposition : MonoBehaviour { // Use this for initialization static float tpx; static float _targetPosY; static float tpz; static float tw;//target wide static float th;//target height static float td;//target depth static float sw; static float sh; static float sd; static float rsy; static float ofs; public void newposition() { if (string.IsNullOrEmpty(SceneModeManager.SelectedName)) return; float mx = 0; float mz = 0; float my = 0; int nO = int.Parse(SceneModeManager.SelectedName[4..]); //On Wall string attachedTo = _G.OBJs[nO][22]; if (attachedTo != "floor" && attachedTo != "ceil") { float xf = DOIT.xfzf("x"); float zf = DOIT.xfzf("z"); switch (name) { case "RepositionL": mx = -1 * xf; mz = 1 * zf; break; case "RepositionR": mx = 1 * xf; mz = -1 * zf; break; case "RepositionB": mz = 1 * xf; mx = 1 * zf; break; case "RepositionF": mz = -1 * xf; mx = -1 * zf; break; } } if (attachedTo == "floor" || attachedTo == "ceil") { switch (name) { case "RepositionL": mx = -1; break; case "RepositionR": mx = 1; break; case "RepositionB": mz = 1; break; case "RepositionF": mz = -1; break; } } if (name == "RepositionT") { my = 1; } if (name == "RepositionU") { my = -1; } GameObject objectToMove = GameObject.Find(SceneModeManager.SelectedName); objectToMove.GetComponent().MoveObjectToPos(objectToMove.transform.position + new Vector3(mx, my, mz)); TopControl.ShowMesure(); string category = _G.OBJs[nO][0].Substring(0, 4); if (_G.OBJs[nO][22][..1] == "w" && (category == "door" || category == "wind" || category == "pati" || category == "open")) { HOLE.wall(_G.OBJs[nO][22]); } // if (!string.IsNullOrEmpty(_G.HIT) && _G.OBJs[nO][22][..1] != "w" ) { Push.It(); } // else DOIT.SaveObjectPositionInData(SceneModeManager.SelectedName); DOIT.SaveObjectPositionInData(SceneModeManager.Selected); } public static void setposition(float V) { GameObject sel = GameObject.Find(SceneModeManager.SelectedName).gameObject; int objectIndex = Get.GetObjectIndex(SceneModeManager.SelectedName); Vector3 POS = sel.transform.position; float px = POS.x; float py = POS.y; float pz = POS.z; float Ow = sel.transform.localScale.x - 0.5f; float Oh = sel.transform.localScale.y - 0.5f; float Od = sel.transform.localScale.z - 0.5f; Ow = Mathf.Round(Ow * 1000.0f) * 0.001f; Oh = Mathf.Round(Oh * 1000.0f) * 0.001f; Od = Mathf.Round(Od * 1000.0f) * 0.001f; if (_G.MeasureFromCenter) { Ow = 0.0f; } float Qwl = sel.transform.localScale.x - 0.5f; Vector3 SO = sel.transform.lossyScale; float OXd = Ow; float OZd = _G.MeasureFromCenter ? 0.0f : Od; if (_G.OBJs[objectIndex][22] != "floor" && _G.OBJs[objectIndex][22] != "ceil") { float pmx = DOIT.getPn("x"); float pmz = DOIT.getPn("z"); float xf = DOIT.xfzf("x"); float zf = DOIT.xfzf("z"); int WA = DOIT.GetWallAngle();//Wall angle float ww = DOIT.xfzf("ww");//Wall widw if (_G.VT.name == "mcR") { float md = V + Ow / 2; if (ww < V + Ow) V = ww - Ow; md = V + Ow / 2; if (WA == 0) px = pmx + ww / 2 - md; if (WA == 180) px = pmx - ww / 2 + md; if (WA == 90) pz = pmz - ww / 2 + md; if (WA == 270) pz = pmz + ww / 2 - md; if (WA == 45) { float os = -Od / 2; string cat = _G.OBJs[objectIndex][0].Substring(0, 4); // if (cat == "wind") os = 4; // if (cat == "door") os = 1.5f; // if (cat == "open") os = 1.5f; // if (cat == "pati") os = 4; px = pmx + (ww / 2 - V - Ow / 2 + os) * 0.707f; pz = pmz - (ww / 2 - V - Ow / 2 - os) * 0.707f; } if (WA == 315) { //print("MRRR & 315"); float os = -Od / 2; string cat = _G.OBJs[objectIndex][0].Substring(0, 4); // if (cat == "wind") os = 4; // if (cat == "door") os = 1.5f; // if (cat == "open") os = 1.5f; // if (cat == "pati") os = 4; px = pmx + (ww / 2 - V - Ow / 2 - os) * 0.707f; pz = pmz + (ww / 2 - V - Ow / 2 + os) * 0.707f; } } if (_G.VT.name == "mcL") { float md = V + Ow / 2; if (ww < V + Ow) V = ww - Ow; md = V + Ow / 2; if (WA == 0) px = pmx - ww / 2 + md; if (WA == 180) px = pmx + ww / 2 - md; if (WA == 90) pz = pmz + ww / 2 - md; if (WA == 270) pz = pmz - ww / 2 + md; if (WA == 45) { float os = -Od / 2; string cat = _G.OBJs[objectIndex][0].Substring(0, 4); // if (cat == "wind") os = 4; // if (cat == "door") os = 1.5f; // if (cat == "open") os = 1.5f; // if (cat == "pati") os = 4; px = pmx - (ww / 2 - V - Ow / 2 - os) * 0.707f; pz = pmz + (ww / 2 - V - Ow / 2 + os) * 0.707f; } if (WA == 315) { //print("MLLLL & 315"); float os = -Od / 2; string cat = _G.OBJs[objectIndex][0].Substring(0, 4); // if (cat == "wind") os = 4; // if (cat == "door") os = 1.5f; // if (cat == "open") os = 1.5f; // if (cat == "pati") os = 4; px = pmx - (ww / 2 - V - Ow / 2 + os) * 0.707f; pz = pmz - (ww / 2 - V - Ow / 2 - os) * 0.707f; } } if (_G.VT.name == "mcB") { float omdx = px - pmx; float omdz = pz - pmz; float Td = Mathf.Sqrt((omdx) * (omdx) + (omdz) * (omdz)); float A = Mathf.Atan2(omdz, omdx) * 180 / Mathf.PI; float dox = -Td * Mathf.Cos((A - 0) * Mathf.PI / 180); float doz = -Td * Mathf.Sin((A - 0) * Mathf.PI / 180); px = pmx - (V - _G.Vo) * zf - dox; pz = pmz - (V - _G.Vo) * xf - doz; //print("pz 2="+pz); } } if (_G.OBJs[objectIndex][22] == "floor" || _G.OBJs[objectIndex][22] == "ceil") { if (_G.VT.name == "mcR") { px = _G.WIDE / 2 - V - OXd / 2; } if (_G.VT.name == "mcL") { px = -_G.WIDE / 2 + V + OXd / 2; } if (_G.VT.name == "mcB") { pz = _G.DEPTH / 2 - V - OZd / 2; } if (_G.VT.name == "mcF") { pz = -_G.DEPTH / 2 + V + OZd / 2; } } if (_G.VT.name == "mcT") { float md = V + Oh / 2; if (_G.HEIGHT < V + Oh) V = _G.HEIGHT - Oh; md = V + Oh / 2; py = _G.HEIGHT / 2 - md; } if (_G.VT.name == "mcU") { float md = V + Oh / 2; if (_G.HEIGHT < V + Oh) V = _G.HEIGHT - Oh; md = V + Oh / 2; py = -_G.HEIGHT / 2 + md; } GameObject.Find(SceneModeManager.SelectedName).gameObject.GetComponent()?.MoveObjectToPos(new Vector3(px, py, pz)); TopControl.ShowMesure(); string category = _G.OBJs[objectIndex][0].Substring(0, 4); if (_G.OBJs[objectIndex][22].Substring(0, 1) == "w" && (category == "door" || category == "wind" || category == "pati" || category == "open")) { HOLE.wall(_G.OBJs[objectIndex][22]); } } public static void centerOnWall(float V) { GameObject sel = GameObject.Find(SceneModeManager.SelectedName).gameObject; int nO = Get.GetObjectIndex(SceneModeManager.SelectedName); Vector3 POS = sel.transform.position; float px = POS.x; float py = POS.y; float pz = POS.z; float Ow = sel.transform.localScale.x - 0.5f; float Oh = sel.transform.localScale.y - 0.5f; float Od = sel.transform.localScale.z - 0.5f; Ow = Mathf.Round(Ow * 1000.0f) * 0.001f; Oh = Mathf.Round(Oh * 1000.0f) * 0.001f; Od = Mathf.Round(Od * 1000.0f) * 0.001f; float Qwl = sel.transform.localScale.x - 0.5f; float pmx = DOIT.getPn("x"); float pmz = DOIT.getPn("z"); float xf = DOIT.xfzf("x"); float zf = DOIT.xfzf("z"); int WA = DOIT.GetWallAngle();//Wall angle float ww = DOIT.xfzf("ww");//Wall widw float md = V + Ow / 2; if (ww < V + Ow) V = ww - Ow; md = V + Ow / 2; if (WA == 0) px = pmx - ww / 2 + md; if (WA == 180) px = pmx + ww / 2 - md; if (WA == 90) pz = pmz + ww / 2 - md; if (WA == 270) pz = pmz - ww / 2 + md; if (WA == 45) { float os = -Od / 2; string cat = _G.OBJs[nO][0].Substring(0, 4); // if (cat == "wind") os = 4; // if (cat == "door") os = 1.5f; // if (cat == "open") os = 1.5f; // if (cat == "pati") os = 4; px = pmx - (ww / 2 - V - Ow / 2 - os) * 0.707f; pz = pmz + (ww / 2 - V - Ow / 2 + os) * 0.707f; } if (WA == 315) { //print("MLLLL & 315"); float os = -Od / 2; string cat = _G.OBJs[nO][0].Substring(0, 4); // if (cat == "wind") os = 4; // if (cat == "door") os = 1.5f; // if (cat == "open") os = 1.5f; // if (cat == "pati") os = 4; px = pmx - (ww / 2 - V - Ow / 2 + os) * 0.707f; pz = pmz - (ww / 2 - V - Ow / 2 - os) * 0.707f; } GameObject.Find(SceneModeManager.SelectedName).GetComponent()?.MoveObjectToPos(new Vector3(px, py, pz)); Gridding.SnapOn(SceneModeManager.SelectedName); } //SnapON---------------------------------------------------- public static void SetOnTarget(string faceToSnapOn, string squareToEnable, float angle) { // always 0 so unused?? ofs = 0; float SelRotationY=angle; GameObject sel = GameObject.Find(SceneModeManager.SelectedName); GameObject tar = GameObject.Find(_G.TARGET); int ntO = Get.GetObjectIndex(_G.TARGET); int nsO = Get.GetObjectIndex(SceneModeManager.SelectedName); Transform scene = sel.transform.parent; GameObject RR = GameObject.Find("RR"); float Ry = DOIT.ConvertStringToNumber(_G.OBJs[ntO][19]); tar.transform.SetParent(RR.transform); RR.transform.localRotation = Quaternion.Euler(0, -Ry, 0);//Room Rotation Vector3 PT = tar.transform.position; tpx = PT.x; _targetPosY = PT.y; tpz = PT.z; string TAR = _G.OBJs[ntO][4]; string SEL = _G.OBJs[nsO][4]; if (TAR == "B1" && faceToSnapOn == "B") { SelRotationY+= 180; } if(SEL=="panel") { if (TAR == "B2" && faceToSnapOn == "L" ) { SelRotationY+= 90; } if (TAR == "B3" && faceToSnapOn == "R" ) { SelRotationY-= 90; } if (TAR == "W2" && faceToSnapOn == "L" ) { SelRotationY+= 90; } if (TAR == "W3" && faceToSnapOn == "R" ) { SelRotationY-= 90; } if (TAR == "B1" && faceToSnapOn == "B") { SelRotationY+= 90; } if (TAR == "B1" && faceToSnapOn == "L") { SelRotationY+= 180; } if (TAR == "T1" && faceToSnapOn == "B") { SelRotationY+= 90; } if (TAR == "T1" && faceToSnapOn == "L") { SelRotationY+= 180; } if (TAR == "W1" && faceToSnapOn == "B") { SelRotationY+= 90; } if (TAR == "W1" && faceToSnapOn == "L") { SelRotationY+= 180; } } //if (TAR == "B1" && SEL=="panel" && faceToSnapOn == "L") { SelRotationY+= 90; } //if (TAR == "B1" && SEL=="panel" && faceToSnapOn == "R") { SelRotationY-= 90; } //sel.transform.localRotation = Quaternion.Euler(0, SelRotationY, 0); sel.transform.eulerAngles = new Vector3(0, SelRotationY, 0); Vector3 Tv = tar.transform.GetComponent().bounds.size; // rsy only used here and value never assigned so default to 0 float offset = Mathf.Abs(0.5f * Mathf.Sin(rsy * Mathf.Deg2Rad)) + Mathf.Abs(0.5f * Mathf.Cos(rsy * Mathf.Deg2Rad)); tw = Tv.x - 0.5f; th = Tv.y - 0.5f; td = Tv.z - 0.5f; if (_G.OBJs[ntO][11] == null || _G.OBJs[ntO][11] == "none") _G.OBJs[ntO][11] = "0"; if (TAR == "W4" && faceToSnapOn == "L") { faceToSnapOn = "F"; } if (TAR == "W2" && faceToSnapOn == "L") { faceToSnapOn = "F"; } if (TAR == "W5" && faceToSnapOn == "R") { faceToSnapOn = "F"; } if (TAR == "W3" && faceToSnapOn == "R") { faceToSnapOn = "F"; } if (TAR == "B2" && faceToSnapOn == "L") { faceToSnapOn = "F"; } if (TAR == "B9" && faceToSnapOn == "L") { faceToSnapOn = "F"; } if (TAR == "B4" && faceToSnapOn == "L") { faceToSnapOn = "F"; } if (TAR == "B3" && faceToSnapOn == "R") { faceToSnapOn = "F"; } if (TAR == "B10" && faceToSnapOn == "R") { faceToSnapOn = "F"; } if (TAR == "B5" && faceToSnapOn == "R") { faceToSnapOn = "F"; } if (TAR == "dish") th -= DOIT.ConvertStringToNumber(_G.OBJs[ntO][11]); //if (TAR == "B1" && faceToSnapOn == "R") { Ry+= 180; } //if (TAR == "B1" && faceToSnapOn == "B") { SelRotationY+= 180; } Vector3 Sv = sel.transform.GetComponent().bounds.size; sw = Sv.x - offset; sh = Sv.y - 0.5f; sd = Sv.z - offset; sw = Gridding.addGrid(sw); sh = Gridding.addGrid(sh); sd = Gridding.addGrid(sd); string model = _G.OBJs[nsO][1]; if ((model != null && model.IndexOf("STOV") != -1) || (SEL != null && SEL.IndexOf("frid") != -1)) { _targetPosY = -_G.HEIGHT / 2 + sh / 2; } if (faceToSnapOn == "I" || faceToSnapOn == "IDrop") { GameObject DropDownList =Get.o2("PNL/ADDTO", "InsideBayList"); DropDownList.SetActive(true); Dropdown DropdownList= Get.o2("PNL/ADDTO", "InsideBayList").GetComponent(); string[] DoorPatern=_G.OBJs[ntO][25].Split('_'); float TargetPositionY=DOIT.ConvertStringToNumber(_G.OBJs[ntO][16]); float KickHeight=DOIT.ConvertStringToNumber(_G.OBJs[ntO][10]); float CounterHeight=DOIT.ConvertStringToNumber(_G.OBJs[ntO][11]); float CabinetTotalHeight=DOIT.ConvertStringToNumber(DoorPatern[1])+KickHeight+CounterHeight;//-top ccounter for base cab Dictionary Openeing =new(); List ListOpeneing =new(); float PosiyionX=0; float PosiyionY=0; int OpeningNumber=0; float DoorPaternWide=DOIT.ConvertStringToNumber(DoorPatern[0]);//24 float SelObjectHeight=DOIT.ConvertStringToNumber(_G.OBJs[nsO][7]); for(int i=2; i=DoorPaternWide) { PosiyionY+=DOIT.ConvertStringToNumber(DoorPatern[i+2]);// //31 //48 PosiyionX=0; } if(DoorPatern[i]=="o" || DoorPatern[i]=="c" ){ OpeningNumber+=1; Openeing.Add(OpeningNumber,PosiyionY); ListOpeneing.Add(OpeningNumber.ToString()); } } if(faceToSnapOn != "IDrop"){ DropdownList.ClearOptions (); DropdownList.AddOptions(ListOpeneing); } int BayValue=DropdownList.value+1; if(ListOpeneing.Count<2)DropDownList.SetActive(false); _targetPosY=TargetPositionY+CabinetTotalHeight*0.5f-Openeing[BayValue]+SelObjectHeight*0.5f; } //_targetPosY=0; SetOnFace(faceToSnapOn, squareToEnable); sel.transform.position = new Vector3(tpx, _targetPosY, tpz); sel.transform.SetParent(tar.transform); //sel.transform.localRotation = Quaternion.Euler(0, SelRotationY, 0); RR.transform.localRotation = Quaternion.Euler(0, 0, 0); sel.transform.SetParent(scene); tar.transform.SetParent(scene); tar.transform.localRotation = Quaternion.Euler(0, Ry, 0); if (_G.OBJs[ntO][22] == "floor") _G.OBJs[nsO][22] = "floor"; DOIT.SaveObjectPositionInData(SceneModeManager.Selected); } public static float dist(string w) { int wn = int.Parse(w.Substring(1, 1)); int nO = Get.GetObjectIndex(SceneModeManager.SelectedName); float d = MESURE.FindXWonWall(nO, wn, "Z"); return d; } public static void SetOnFace(string P, string p) { GameObject.Find("ADDTO").transform.Find("Square").gameObject.SetActive(true); if (P == "F") { tpz = tpz - td / 2 - sd / 2; if (p == "P1") { tpx = tpx - tw / 2 + sw / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P2") { _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P3") { tpx = tpx + tw / 2 - sw / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P4") { tpx = tpx - tw / 2 + sw / 2; } if (p == "P5") { } if (p == "P6") { tpx = tpx + tw / 2 - sw / 2; } if (p == "P7") { tpx = tpx - tw / 2 + sw / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P8") { _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P9") { tpx = tpx + tw / 2 - sw / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } } if (P == "R") { tpx = tpx + tw / 2 + sw / 2; if (p == "P1") { tpz = tpz - td / 2 + sd / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P2") { _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P3") { tpz = tpz + td / 2 - sd / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P4") { tpz = tpz - td / 2 + sd / 2; } if (p == "P5") { _targetPosY = _targetPosY + ofs; } if (p == "P6") { tpz = tpz + td / 2 - sd / 2; } if (p == "P7") { tpz = tpz - td / 2 + sd / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P8") { _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P9") { tpz = tpz + td / 2 - sd / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } } if (P == "L") { tpx = tpx - tw / 2 - sw / 2; if (p == "P1") { tpz = tpz + td / 2 - sd / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P2") { _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P3") { tpz = tpz - td / 2 + sd / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P4") { tpz = tpz - td / 2 + sd / 2; } if (p == "P5") { _targetPosY = _targetPosY + ofs; } if (p == "P6") { tpz = tpz + td / 2 - sd / 2; } if (p == "P7") { tpz = tpz + td / 2 - sd / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P8") { _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P9") { tpz = tpz - td / 2 + sd / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } } if (P == "T") { _targetPosY = _targetPosY + th / 2 + sh / 2; if (p == "P1") { tpz = tpz + td / 2 - sd / 2; tpx = tpx - tw / 2 + sw / 2; } if (p == "P2") { tpz = tpz + td / 2 - sd / 2; } if (p == "P3") { tpz = tpz + td / 2 - sd / 2; tpx = tpx + tw / 2 - sw / 2; } if (p == "P4") { tpx = tpx - tw / 2 + sw / 2; } if (p == "P5") { } if (p == "P6") { tpx = tpx + tw / 2 - sw / 2; } if (p == "P7") { tpz = tpz - td / 2 + sd / 2; ; tpx = tpx - tw / 2 + sw / 2; } if (p == "P8") { tpz = tpz - td / 2 + sd / 2; } if (p == "P9") { tpz = tpz - td / 2 + sd / 2; tpx = tpx + tw / 2 - sw / 2; } } if (P == "I") { if (p == "P1") { tpz = tpz + td / 2 - sd / 2; tpx = tpx - tw / 2 + sw / 2; } if (p == "P2") { tpz = tpz + td / 2 - sd / 2; } if (p == "P3") { tpz = tpz + td / 2 - sd / 2; tpx = tpx + tw / 2 - sw / 2; } if (p == "P4") { tpx = tpx - tw / 2 + sw / 2; } if (p == "P5") { } if (p == "P6") { tpx = tpx + tw / 2 - sw / 2; } if (p == "P7") { tpz = tpz - td / 2 + sd / 2; ; tpx = tpx - tw / 2 + sw / 2; } if (p == "P8") { tpz = tpz - td / 2 + sd / 2; } if (p == "P9") { tpz = tpz - td / 2 + sd / 2; tpx = tpx + tw / 2 - sw / 2; } } if (P == "B") { tpz = tpz + td / 2 + sd / 2; if (p == "P1") { tpx = tpx + tw / 2 - sw / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P2") { _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P3") { tpx = tpx - tw / 2 + sw / 2; _targetPosY = _targetPosY + th / 2 - sh / 2; } if (p == "P4") { tpx = tpx + tw / 2 - sw / 2; } if (p == "P5") { _targetPosY = _targetPosY + ofs; } if (p == "P6") { tpx = tpx - tw / 2 + sw / 2; } if (p == "P7") { tpx = tpx + tw / 2 - sw / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P8") { _targetPosY = _targetPosY - th / 2 + sh / 2; } if (p == "P9") { tpx = tpx - tw / 2 + sw / 2; _targetPosY = _targetPosY - th / 2 + sh / 2; } } if (P == "U") { _targetPosY = _targetPosY - th / 2 - sh / 2; if (p == "P1") { tpx = tpx - tw / 2 + sw / 2; tpz = tpz + td / 2 - sd / 2; } if (p == "P2") { tpz = tpz + td / 2 - sd / 2; } if (p == "P3") { tpx = tpx + tw / 2 - sw / 2; tpz = tpz + td / 2 - sd / 2; } if (p == "P4") { tpx = tpx - tw / 2 + sw / 2; } if (p == "P5") { } if (p == "P6") { tpx = tpx + tw / 2 - sw / 2; } if (p == "P7") { tpx = tpx - tw / 2 + sw / 2; tpz = tpz - td / 2 + sd / 2; } if (p == "P8") { tpz = tpz - td / 2 + sd / 2; } if (p == "P9") { tpx = tpx + tw / 2 - sw / 2; tpz = tpz - td / 2 + sd / 2; } } } public static void newResizeposition(string DIR, float dis) { if (SceneModeManager.SelectedName != "") { float mx = 0; float mz = 0; float my = 0; int nO = int.Parse(SceneModeManager.SelectedName.Substring(4, SceneModeManager.SelectedName.Length - 4)); GameObject sel = GameObject.Find(SceneModeManager.SelectedName).gameObject; float Opx = sel.transform.position.x; float Opy = sel.transform.position.y; float Opz = sel.transform.position.z; float Ow = DOIT.ConvertStringToNumber(_G.OBJs[nO][6]); float Oh = DOIT.ConvertStringToNumber(_G.OBJs[nO][7]); float Od = DOIT.ConvertStringToNumber(_G.OBJs[nO][8]); //On Wall if (_G.OBJs[nO][22] != "floor" && _G.OBJs[nO][22] != "ceil") { int nW = int.Parse(_G.OBJs[nO][22].Substring(1, 1)); GameObject wall = GameObject.Find("w" + nW.ToString(CultureInfo.InvariantCulture)).gameObject; float Ww = 0; float a = 0; if (nW == 1) { Ww = _G. WallsWidth[1 - 1]; a = _G. WallsAngle[1 - 1]; } if (nW == 2) { Ww = _G. WallsWidth[2 - 1]; a = _G. WallsAngle[2 - 1]; } if (nW == 3) { Ww = _G. WallsWidth[3 - 1]; a = _G. WallsAngle[3 - 1]; } if (nW == 4) { Ww = _G. WallsWidth[4 - 1]; a = _G. WallsAngle[4 - 1]; } if (nW == 5) { Ww = _G. WallsWidth[5 - 1]; a = _G. WallsAngle[5 - 1]; } if (nW == 6) { Ww = _G. WallsWidth[6 - 1]; a = _G. WallsAngle[6 - 1]; } float Wpx = wall.transform.position.x; float Wpy = wall.transform.position.y; float Wpz = wall.transform.position.z; float xf = DOIT.xfzf("x"); float zf = DOIT.xfzf("z"); if (DIR == "R") { mx = -dis * xf; mz = dis * zf; } if (DIR == "L") { mx = dis * xf; mz = -dis * zf; } if (DIR == "F") { mz = dis * xf; mx = dis * zf; } if (DIR == "B") { mz = -dis * xf; mx = -dis * zf; } } if (_G.OBJs[nO][22] == "floor" || _G.OBJs[nO][22] == "ceil") { if (DIR == "R") { mx = -dis; } if (DIR == "L") { mx = dis; } if (DIR == "F") { mz = dis; } if (DIR == "B") { mz = -dis; } } if (DIR == "T") { my = -dis; } if (DIR == "U") { my = dis; } //Vector3 temp = new Vector3(mx, my, mz); //GameObject.Find(SceneModeManager.SelectedName).gameObject.transform.position += temp; GameObject objectToMove = GameObject.Find(SceneModeManager.SelectedName); objectToMove.GetComponent()?.MoveObjectToPos(objectToMove.transform.position + new Vector3(mx, my, mz)); TopControl.ShowMesure(); if (_G.OBJs[nO][22].Substring(0, 1) == "w" && _G.OBJs[nO][0].Substring(0, 4) == "door") HOLE.wall(_G.OBJs[nO][22]); if (_G.OBJs[nO][22].Substring(0, 1) == "w" && _G.OBJs[nO][0].Substring(0, 4) == "wind") HOLE.wall(_G.OBJs[nO][22]); if (_G.OBJs[nO][22].Substring(0, 1) == "w" && _G.OBJs[nO][0].Substring(0, 4) == "pati") HOLE.wall(_G.OBJs[nO][22]); if (_G.OBJs[nO][22].Substring(0, 1) == "w" && _G.OBJs[nO][0].Substring(0, 4) == "open") HOLE.wall(_G.OBJs[nO][22]); print("_G.HIT)================"+_G.HIT); print("_G.OBJs[nO][22][..1]================"+_G.OBJs[nO][22][..1]); // if (!string.IsNullOrEmpty(_G.HIT) && _G.OBJs[nO][22][..1] != "w" ) { Push.It(); } // else DOIT.SaveObjectPositionInData(SceneModeManager.SelectedName); DOIT.SaveObjectPositionInData(SceneModeManager.Selected); //Collision.check(nO); } } }