using System; using UnityEngine; using UnityEngine.AI; public class DOSIDE : MonoBehaviour { static float KickFrontProjection; static float PanelThickness; static float KickHeight; static GameObject BASE; public static void PNLNew(GameObject Base, int nO, float PosY, float BoxDepth, float hbox, float Kh, float kf, float pt,Vector3 CenterBox,float Back45)//dT , { BASE = Base; string[] C = _G.OBJs[nO]; float w = DOIT.ConvertStringToNumber(C[6]); float h = DOIT.ConvertStringToNumber(C[7]); float d = DOIT.ConvertStringToNumber(C[8]); float HBKT = DOIT.ConvertStringToNumber(C[7]) + DOIT.ConvertStringToNumber(C[11]); float T = DOIT.ConvertStringToNumber(C[11]); float t = _G.cat; float E = DOIT.ConvertStringToNumber(C[28]); float F = DOIT.ConvertStringToNumber(C[29]); Vector3 Size, Pos, Rot; KickFrontProjection = kf; PanelThickness = pt; KickHeight = Kh; GameObject TOP, UNDER, TOPB; //BOX POSITION float backBox=CenterBox.z+BoxDepth ; float frontBox=CenterBox.z-BoxDepth ; float leftBox=CenterBox.x-w*0.5f; float rightBox=CenterBox.x+w*0.5f; //PANELS ARROUND if (Get.Bool(C[4], "B1_B8_W1_T1")) { Size = new(d, hbox, t); Pos = new(leftBox + t * 0.5f, PosY, frontBox+d*0.5f); Rot = new(0, -90, 0); CreatePnl("S1", C, 1, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); //Exterior,Interior,Front,Top,Under,Back //9 not visible Size = new(w - t * 2, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 9, 2, 4, 1); Size = new(d, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, frontBox+d*0.5f); Rot = new(0, -90, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } if (Get.Bool(C[4], "B9_W9")) { Size = new(E, hbox, t); Pos = new(leftBox + t * 0.5f + E * 0.5f, PosY, frontBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S1", C, 1, Size, Pos, Rot, 0, 1, 3, 2, 4, 5); Size = new(d, hbox, t); Pos = new(leftBox + t * 0.5f, PosY, frontBox+d*0.5f); Rot = new(0, 0 - 90, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 9, 2, 4, 3); Size = new(w - t * 2, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 1, 0, 9, 2, 4, 9); Size = new(d, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, frontBox+d*0.5f); Rot = new(0, -90, 0); CreatePnl("S4", C, 4, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } if (Get.Bool(C[4], "B10_W10")) { Size = new(d, hbox, t); Pos = new(leftBox + t * 0.5f, PosY, frontBox+d*0.5f); Rot = new(0, 0 - 90, 0); CreatePnl("S1", C, 1, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(w - t * 2, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 9, 2, 4, 9); Size = new(d, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, frontBox+d*0.5f); Rot = new(0, -90, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); Size = new(F, hbox, t); Pos = new(rightBox - t * 0.5f - F * 0.5f, PosY, frontBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S4", C, 4, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); //Exterior,Interior,Front,Top,Under,Back } if (Get.Bool(C[4], "B2_W2_B4_W4_B6_W6")) { if(Back45!=0){ float BackWide=Back45/ 0.7071f; Size = new(BackWide, hbox, t); Pos = new(leftBox + Back45* 0.5f+t, PosY, backBox - Back45* 0.5f-t); Rot = new(0, -45, 0); CreatePnl("S5", C, 5, Size, Pos, Rot, 1, 0, 5, 2, 4, 3);//Notch_Std_Std_Notch_None_Std_Strech } Size = new(E, hbox, t); Pos = new(leftBox + E * 0.5f, PosY, frontBox + t * 0.5f); Rot = new(0, 180, 0); CreatePnl("S1", C, 1, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(d -Back45- t, hbox, t); Pos = new(leftBox + t * 0.5f, PosY,backBox -d*0.5f -Back45*0.5f); Rot = new(0, -90, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 9, 2, 4, 3); Size = new(w-Back45 - t , hbox, t); Pos = new(CenterBox.x+Back45*0.5f, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(F, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, backBox - F * 0.5f); Rot = new(0, -90, 0); CreatePnl("S4", C, 4, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } if (Get.Bool(C[4], "B3_W3_B5_W5_B7_W7")) { if(Back45!=0){ float BackWide=Back45/ 0.7071f; Size = new(BackWide, hbox, t); Pos = new(rightBox - Back45* 0.5f-t, PosY, backBox - Back45* 0.5f-t); Rot = new(0, 45, 0); CreatePnl("S5", C, 5, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); } Size = new(E, hbox, t); Pos = new(leftBox+ t * 0.5f , PosY, backBox - E*0.5f ); Rot = new(0, -90, 0); CreatePnl("S1", C, 1, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(w-Back45-t, hbox, t); Pos = new(CenterBox.x-Back45*0.5f, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(d -Back45- t, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, frontBox+d*0.5f - t * 0.5f-Back45*0.5f); Rot = new(0, -90, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); Size = new(F, hbox, t); Pos = new(rightBox -F*0.5f, PosY, frontBox+ t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S4", C, 4, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } if (Get.Bool(C[4], "B11_W11")) { Size = new(d , hbox, t); Pos = new(leftBox + t * 0.5f, PosY,frontBox+d*0.5f ); Rot = new(0, -90, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 9, 2, 4, 3); Size = new(w - t * 2, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 180, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 0, 1, 9, 2, 4, 9); Size = new(F, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, backBox - F * 0.5f); Rot = new(0, -90, 0); CreatePnl("S4", C, 4, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } if (Get.Bool(C[4], "B12_W12")) { Size = new(E, hbox, t); Pos = new(leftBox + t * 0.5f, PosY,backBox - E * 0.5f ); Rot = new(0, -90, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 9, 2, 4, 3); Size = new(w - t * 2, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 180, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 0, 1, 9, 2, 4, 9); Size = new(d, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, frontBox); Rot = new(0, -90, 0); CreatePnl("S4", C, 4, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } if (Get.Bool(C[4], "B26_W26")) { Size = new(d - t, hbox, t); Pos = new(leftBox + t * 0.5f, PosY, frontBox+d*0.5f - t * 0.5f); Rot = new(0, -90, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(w, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 1, 0, 3, 2, 4, 5); } if (Get.Bool(C[4], "B27_W27")) { Size = new(w, hbox, t); Pos = new(CenterBox.x, PosY, backBox - t * 0.5f); Rot = new(0, 0, 0); CreatePnl("S2", C, 2, Size, Pos, Rot, 1, 0, 5, 2, 4, 3); Size = new(d - t, hbox, t); Pos = new(rightBox - t * 0.5f, PosY, frontBox +d*0.5f- t * 0.5f); Rot = new(0, -90, 0); CreatePnl("S3", C, 3, Size, Pos, Rot, 0, 1, 5, 2, 4, 3); } //TOP and UNDER if (Get.Bool(C[4], "B1_B8_W1_T1_B9_B10_W9_W10")) { Size = new(w - t * 2, t, d - t); string[] FINISH = new string[] { C[62], C[62], C[62], C[62], C[62], C[62] }; if (C[83].Split('_')[5] == "1") { FINISH[4] = C[69]; }//Exterior is finish if (C[87].Split('_')[5] == "1") { FINISH[2] = C[69]; }//Interior is finish //FINISH[0] = C[62];//Front is finish 69 not finish 62 Pos= new(CenterBox.x, -HBKT * 0.5f + Kh + t / 2, backBox - t - (d - t) * 0.5f); Rot=new(0, 0, 0); string TopCategory = C[78].Split('_')[6]; string UnderCategory = C[78].Split('_')[5]; //UNDER = Create_Standard_Panel("Under", Size, FINISH); //UNDER.transform.position = new(CenterBox.x, -HBKT * 0.5f + Kh + t / 2, backBox - t - (d - t) * 0.5f); //UNDER.transform.parent = BASE.transform; if (UnderCategory.IndexOf("Projection")==-1)CreatePnl("Under", C, 6, Size, Pos, Rot, 4, 2, 0, 2, 4, 1);//Exterior,Interior,Front,Top,Under,Back //If Top FULL,Stretch,Stretch_back FINISH = new string[] { C[62], C[62], C[62], C[62], C[62], C[62] }; if (C[83].Split('_')[6] == "1") { FINISH[2] = C[69]; }//Exterior is finish if (C[87].Split('_')[6] == "1") { FINISH[4] = C[69]; }//Interior is finish FINISH[0] = FINISH[2];//Front is finish //Std_Std_Std_None_None_Std_Strech if (TopCategory == "Full" || TopCategory == "full" || TopCategory == "Std") { TOP = Create_Standard_Panel("Top", Size, FINISH); TOP.transform.position = new(CenterBox.x, HBKT * 0.5f - t / 2 - T, backBox - t - (d - t) * 0.5f); TOP.transform.parent = BASE.transform; } if (TopCategory == "Stretch" || TopCategory == "Strech" ) { FINISH[0] = C[62];//Front is finish Size.z = 3; TOPB = Create_Standard_Panel("Top1", Size, FINISH); TOPB.transform.position = new(CenterBox.x, HBKT * 0.5f - t / 2 - T, backBox - t - Size.z * 0.5f); TOPB.transform.parent = BASE.transform; //FINISH[0] = C[69];//Front is finish TOP = Create_Standard_Panel("Top1", Size, FINISH); string Unique_Name = Get.LibraryValue(C[1], CsvHeaders.Unique_Name, DataTypes.Cabinet); if (Unique_Name.IndexOf("-FG") != -1) { Size.z += 2; } TOP.transform.position = new(CenterBox.x, HBKT * 0.5f - t / 2 - T, frontBox + Size.z * 0.5f); TOP.transform.parent = BASE.transform; } if (TopCategory == "BackStretch") { FINISH[0] = C[62];//Front is finish Size.z = 3; TOPB = Create_Standard_Panel("TopB", Size, FINISH); TOPB.transform.position = new(CenterBox.x, HBKT * 0.5f - t / 2 - T, backBox - t - Size.z * 0.5f); TOPB.transform.parent = BASE.transform; } //If Under Projection if (UnderCategory.IndexOf("Projection")!=-1) { FINISH = new string[] { C[69], C[69], C[69], C[69], C[69], C[69]}; float Projection=float.Parse(UnderCategory[10..]); Size.z = Projection+d; TOPB = Create_Standard_Panel("UnderB", Size, FINISH); TOPB.transform.position = new(CenterBox.x, -HBKT * 0.5f + t / 2 - T, backBox - t - Size.z * 0.5f); TOPB.transform.parent = BASE.transform; } } if (Get.Bool(C[4], "B2_W2")) { //TOP string ShelfTexture = C[62]; if (C[83].Split('_')[6] == "1" || C[87].Split('_')[6] == "1") { ShelfTexture = C[69]; }//Exterior is finish if(Back45==0)Back45=0.1f; Vector3[] Points=new Vector3[7]{ new(leftBox + t, 0, frontBox + t), new(leftBox + t, 0, backBox - t-Back45), new(leftBox +t + Back45, 0, backBox - t), new(rightBox - t, 0, backBox - t), new(rightBox - t, 0, backBox - F), new(leftBox + E, 0, backBox - F), new(leftBox + E, 0, frontBox + t) }; TOP = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); TOP.transform.position = new(0, HBKT * 0.5f - T * 0.5f-T*0.5f,0); TOP.transform.parent = BASE.transform; ShelfTexture = C[62]; if (C[83].Split('_')[5] == "1" || C[87].Split('_')[5] == "1") { ShelfTexture = C[69]; }//Exterior is finish UNDER = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); UNDER.transform.position = new(0, -HBKT * 0.5f + Kh + t, 0); UNDER.transform.parent = BASE.transform; } if (Get.Bool(C[4], "B3_W3")) { //TOP string ShelfTexture = C[62]; if (C[83].Split('_')[6] == "1" || C[87].Split('_')[6] == "1") { ShelfTexture = C[69]; }//Exterior is finish if(Back45==0)Back45=0.1f; Vector3[] Points=new Vector3[7]{ new(leftBox + t, 0, backBox - E + t), new(leftBox + t, 0, backBox - t), new(rightBox- t-Back45, 0, backBox - t), new(rightBox - t, 0, backBox - t-Back45), new(rightBox - t, 0, frontBox +t), new(rightBox -F+t, 0, frontBox +t ), new(rightBox -F+t, 0, backBox - E + t) }; TOP = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); TOP.transform.position = new(0, HBKT * 0.5f - T * 0.5f, 0); TOP.transform.parent = BASE.transform; ShelfTexture = C[62]; if (C[83].Split('_')[5] == "1" || C[87].Split('_')[5] == "1") { ShelfTexture = C[69]; }//Exterior is finish UNDER = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); UNDER.transform.position = new(0, -HBKT * 0.5f + Kh + t, 0); UNDER.transform.parent = BASE.transform; } if (Get.Bool(C[4],"B4_W4_W6_W11_B19_W19_B26_W26")) { if(Back45==0)Back45=0.1f; //TOP string ShelfTexture = C[62]; if (C[83].Split('_')[6] == "1" || C[87].Split('_')[6] == "1") { ShelfTexture = C[69]; }//Exterior is finish //if(F<=1 || E<=1)t =0.25f; Vector3[] Points=new Vector3[6]{ new(leftBox + t, 0, frontBox + t), new(leftBox + t, 0, backBox - t-Back45), new(leftBox +t + Back45, 0, backBox - t), new(rightBox - t, 0, backBox - t), new(rightBox - t, 0, backBox - F), new(leftBox + E, 0, frontBox + t) }; TOP = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); TOP.transform.position = new(0, HBKT * 0.5f - T * 0.5f, 0); TOP.transform.parent = BASE.transform; ShelfTexture = C[62]; if (C[83].Split('_')[5] == "1" || C[87].Split('_')[5] == "1") { ShelfTexture = C[69]; }//Exterior is finish UNDER = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); UNDER.transform.position = new(0, -HBKT * 0.5f + Kh + t, 0); UNDER.transform.parent = BASE.transform; TOP.name = "TOP"; UNDER.name = "UNDER"; } if (Get.Bool(C[4], "B5_W5_B7_W7_B20_W20_B27_W27")) { //TOP if (E == 0) E = t; if (F == 0) F = t; float of = t; string ShelfTexture = C[62]; if (C[83].Split('_')[6] == "1" || C[87].Split('_')[6] == "1") { ShelfTexture = C[69]; }//Exterior is finish if(Back45==0)Back45=0.1f; Vector3[] Points=new Vector3[6]{ new(leftBox + t, 0, backBox - E ), new(leftBox + t, 0, backBox - t), new(rightBox- t-Back45, 0, backBox - t), new(rightBox - t, 0, backBox - t-Back45), new(rightBox - t, 0, frontBox +t), new(rightBox -F, 0, frontBox+t) }; TOP = MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); TOP.transform.position = new(0, HBKT * 0.5f - T, 0); TOP.transform.parent = BASE.transform; ShelfTexture = C[62]; if (C[83].Split('_')[5] == "1" || C[87].Split('_')[5] == "1") { ShelfTexture = C[69]; }//Exterior is finish UNDER= MCXMP.MCXV("Shelf",t, Points, ShelfTexture,"Untagged"); UNDER.transform.position = new(0, -HBKT * 0.5f + Kh + t, 0); UNDER.transform.parent = BASE.transform; TOP.name = "TOP"; UNDER.name = "UNDER"; } if (Get.Bool(C[4], "B27_W27")) { // if (E == 0) E = t; // if (F == 0) F = t; // float of = t; // string ShelfTexture = C[62]; // if (C[83].Split('_')[6] == "1" || C[87].Split('_')[6] == "1") { ShelfTexture = C[69]; }//Exterior is finish // Vector3 P1 = new(leftBox + of, 0, backBox - E); // Vector3 P2 = new(leftBox + of, 0, backBox - of); // Vector3 P3 = new(rightBox - of, 0, backBox - of); // Vector3 P4 = new(rightBox - of, 0, frontBox + of); // Vector3 P5 = new(rightBox - F, 0, frontBox + of); // TOP = MCXMP.MCX5VL(t, E, w, P1, P2, P3, P4, P5, ShelfTexture); // TOP.transform.position = new(0, HBKT * 0.5f - T, 0); // UNDER = MCXMP.MCX5VL(t, E, w, P1, P2, P3, P4, P5, ShelfTexture); // UNDER.transform.position = new(0, -HBKT * 0.5f + Kh + t, 0); // TOP.transform.parent = BASE.transform; // TOP.name = "TOP"; // UNDER.transform.parent = BASE.transform; // UNDER.name = "UNDER"; } } public static void CreatePnl(string name, string[] C, int indexCategory, Vector3 Size, Vector3 Pos, Vector3 Rot, int ExtInd, int IntInd, int FrontInd, int TopInd, int UnderInd, int BackInd) { if (C[67] != "NONE" ) { C[78]=DOIT.ChangeCodeOnPos(C[78], 6, "BackStretch", "_"); } // Side_Panel_Recipe string CategoryPanel = C[78].Split('_')[indexCategory - 1]; string[] c83 = C[83].Split('_'); string[] c87 = C[87].Split('_'); string[] FINISH = new string[] { C[62], C[62], C[62], C[62], C[62], C[62] }; if (c83[indexCategory - 1] != "0") { FINISH[ExtInd] = C[69]; }//Exterior is finish if (c87[indexCategory - 1] != "0") { FINISH[IntInd] = C[69]; }//Interior is finish //Edge //Front if (FrontInd != 9) {FINISH[FrontInd] = FINISH[ExtInd];}//C[62];//69 or 62 //Top if (c83[6] == "1") {FINISH[TopInd] =FINISH[ExtInd];}// C[62];// //Under if (c83[5] == "1") {FINISH[UnderInd] = FINISH[ExtInd];}//C[62];// //Back if (c83[5] == "1") {FINISH[BackInd] = FINISH[ExtInd];}//C[69];// GameObject Side = null; if (CategoryPanel == "Std") { Side = Make_Cube(name, Size, FINISH); } if (CategoryPanel == "Over") { Side = Create_Over_Panel(name, Size, FINISH); } if (CategoryPanel == "Notch") { Side = Create_Notch_Panel(name, Size, FINISH); } if (CategoryPanel == "FG") { Side = Create_FingerGripStd_Panel(name, Size, FINISH); }//Finger Grip if (CategoryPanel == "FGN") { Side = Create_FingerGripNotch_Panel(name, Size, FINISH); }//Finger Grip if (CategoryPanel == "Pro2") { Side = Make_Cube_With_Projection(CategoryPanel ,name, Size, new string[] { C[69], C[69], C[69], C[69], C[69], C[69] }); }//Projection if (Side != null) { Side.transform.position = Pos; Side.transform.eulerAngles = Rot; Side.transform.SetParent(BASE.transform); } } //CREATE PANELS public static GameObject Create_Standard_Panel(string name, Vector3 Size, string[] Finish) { GameObject Side = Make_Cube(name, Size, Finish); return Side; } public static GameObject Create_Over_Panel(string name, Vector3 Size, string[] Finish) { Size.y += KickHeight; GameObject Side = new(name); GameObject Panel = Make_Cube(name, Size, Finish); Panel.transform.SetParent(Side.transform); Panel.transform.position = new(0, -KickHeight * 0.5f, 0); return Side; } public static GameObject Create_Notch_Panel(string name, Vector3 Size, string[] Finish) { GameObject Side = new(name); float PosY = 0; float PosX = 0; //TOP GameObject Top = Make_Cube(name, Size, Finish); Top.transform.position = new(0, PosY, 0); Top.transform.SetParent(Side.transform); //KICK PosY = -Size.y * 0.5f - KickHeight * 0.5f; Size.x -= KickFrontProjection + PanelThickness; Size.y = KickHeight; GameObject Under = Make_Cube(name, Size, Finish); PosX += KickFrontProjection * 0.5f + PanelThickness * 0.5f; Under.transform.localPosition = new(PosX, PosY, 0); Under.transform.SetParent(Side.transform); return Side; } public static GameObject Create_FingerGripStd_Panel(string name, Vector3 Size, string[] Finish) { GameObject Side = new(name); float PosY = 0; ; float PosX; float W = Size.x; //TOP Size.x -= 1.25f; GameObject Top = Make_Cube(name, Size, Finish); Top.transform.position = new(1.25f * 0.5F, 0, 0); Top.transform.SetParent(Side.transform); for (int i = 1; i < _G.RTOT + 1; i++) { PosX = -W * 0.5f + 1.25f * 0.5f; Size.x = 1.25f; if (i == 1) { PosY = _G.ROWY1[0] - 0.75f; Size.y = _G.ROWH1[0] - 2.5f; } if (i == 2) { PosY = _G.ROWY1[1] - 0.75f; Size.y = _G.ROWH1[1] - 2.5f; } if (i == 3) { PosY = _G.ROWY1[2] - 0.75f; Size.y = _G.ROWH1[2] - 2.5f; } if (i == 4) { PosY = _G.ROWY1[3] - 0.75f; Size.y = _G.ROWH1[3] - 2.5f; } if (i == 5) { PosY = _G.ROWY1[4] - 0.75f; Size.y = _G.ROWH1[4] - 2.5f; } if (i == 6) { PosY = _G.ROWY1[5] - 0.75f; Size.y = _G.ROWH1[5] - 2.5f; } if (i == _G.RTOT) { Size.y += 0.5f; PosY -= 0.125f; } GameObject Grip1 = Make_Cube(name + "Grip1", Size, Finish); Grip1.transform.localPosition = new(PosX, PosY, 0); Grip1.transform.SetParent(Side.transform); } return Side; } public static GameObject Create_FingerGripNotch_Panel(string name, Vector3 Size, string[] Finish) { GameObject Side = new(name); float PosY; float PosX = 0; float W = Size.x; //TOP Size.x -= 1.25f; GameObject Top = Make_Cube(name, Size, Finish); Top.transform.position = new(1.25f * 0.5F, 0, 0); Top.transform.SetParent(Side.transform); //KICK PosY = -Size.y * 0.5f - KickHeight * 0.5f; Size.x = W - KickFrontProjection - PanelThickness; Size.y = KickHeight; PosX += KickFrontProjection * 0.5f + PanelThickness * 0.5f; GameObject Under = Make_Cube(name, Size, Finish); Under.transform.localPosition = new(PosX, PosY, 0); Under.transform.SetParent(Side.transform); for (int i = 1; i < _G.RTOT + 1; i++) { PosX = -W * 0.5f + 1.25f * 0.5f; Size.x = 1.25f; if (i == 1) { PosY = _G.ROWY1[0] - 0.75f; Size.y = _G.ROWH1[0] - 2.5f; } if (i == 2) { PosY = _G.ROWY1[1] - 0.75f; Size.y = _G.ROWH1[1] - 2.5f; } if (i == 3) { PosY = _G.ROWY1[2] - 0.75f; Size.y = _G.ROWH1[2] - 2.5f; } if (i == 4) { PosY = _G.ROWY1[3] - 0.75f; Size.y = _G.ROWH1[3] - 2.5f; } if (i == 5) { PosY = _G.ROWY1[4] - 0.75f; Size.y = _G.ROWH1[4] - 2.5f; } if (i == 6) { PosY = _G.ROWY1[5] - 0.75f; Size.y = _G.ROWH1[5] - 2.5f; } if (i == _G.RTOT) { Size.y += 0.5f; PosY -= 0.125f; } GameObject Grip1 = Make_Cube(name + "Grip1", Size, Finish); Grip1.transform.localPosition = new(PosX, PosY, 0); Grip1.transform.SetParent(Side.transform); } return Side; } public static GameObject Make_Cube(string name, Vector3 Size, string[] Finish) { float w = Size.x; float h = Size.y; float d = Size.z; GameObject Cube = new(name); GameObject front = CreateFace(name + " front", w, h, 1, 0, 0, -d * 0.5f, 0, 0, 0, Finish[0]); front.transform.SetParent(Cube.transform); GameObject back = CreateFace(name + " back", w, h, 1, 0, 0, d * 0.5f, 0, 180, 0, Finish[1]); back.transform.SetParent(Cube.transform); GameObject top = CreateFace(name + " top", w, d, 1, 0, h * 0.5f, 0, 90, 0, 0, Finish[2]); top.transform.SetParent(Cube.transform); GameObject right = CreateFace(name + " right", d, h, 1, w * 0.5f, 0, 0, 0, -90, 0, Finish[3]); right.transform.SetParent(Cube.transform); GameObject under = CreateFace(name + " under", w, d, 1, 0, -h * 0.5f, 0, -90, 0, 0, Finish[4]); under.transform.SetParent(Cube.transform); GameObject left = CreateFace(name + " left", d, h, 1, -w * 0.5f, 0, 0, 0, 90, 0, Finish[5]); left.transform.SetParent(Cube.transform);//Front return Cube; } public static GameObject Make_Cube_With_Projection(string Pro,string name, Vector3 Size,string[] Finish) { float Projection=float.Parse(Pro.Replace("Pro","")); float w = Size.x; float h = Size.y; float d = Size.z; GameObject Cube = new(name); GameObject front = CreateFace(name + " front", w, h, 1, 0, 0, -d * 0.5f-Projection*0.5f, 0, 0, 0, Finish[0]); front.transform.SetParent(Cube.transform); GameObject back = CreateFace(name + " back", w, h, 1, 0, 0, d * 0.5f-Projection*0.5f, 0, 180, 0, Finish[1]); back.transform.SetParent(Cube.transform); GameObject top = CreateFace(name + " top", w, d+Projection, 1, 0, h * 0.5f, 0-Projection*0.5f, 90, 0, 0, Finish[2]); top.transform.SetParent(Cube.transform); GameObject right = CreateFace(name + " right", d+Projection, h, 1, w * 0.5f, 0, 0-Projection*0.5f, 0, -90, 0, Finish[3]); right.transform.SetParent(Cube.transform); GameObject under = CreateFace(name + " under", w, d+Projection, 1, 0, -h * 0.5f, 0-Projection*0.5f, -90, 0, 0, Finish[4]); under.transform.SetParent(Cube.transform); GameObject left = CreateFace(name + " left", d+Projection, h, 1, -w * 0.5f, 0, 0-Projection*0.5f, 0, 90, 0, Finish[5]); left.transform.SetParent(Cube.transform);//Front return Cube; } public static GameObject CreateFace(string n, float sx, float sy, float sz, float px, float py, float pz, float rx, float ry, float rz, string texcode) { GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Quad); obj.transform.localScale = new Vector3(sx, sy, sz); obj.transform.position = new Vector3(px, py, pz); obj.transform.localRotation = Quaternion.Euler(rx, ry, rz); obj.tag = "bloc"; obj.name = n; obj.GetComponent().enabled = false; obj.GetComponent().material = Instantiate(_G.TEXTURE); CreateBoxPnl.SetMat(obj, texcode); DOIT.SetSizeTex(obj, 48, 48, 0, 0, 0, 0, 90, 90); //obj.GetComponent().probeAnchor = GameObject.Find("Reflection Probe").transform; return obj; } public static void Recover(string Cat, GameObject BASE, string[] C, float W, float H, float K, Vector3 Pos, float Ry, float T, float kf, float Nx, float Nz) { float t = 0.625f; GameObject R = null; GameObject RB = null; float POY; if (Cat == "Floor" || Cat == "1") { POY = -T * 0.5f; R = CreateBoxPnl.Side("SPF", W, H, t, Pos.x, POY, Pos.z, 0, Ry, 0, C[80]); } if (Cat == "Over") { POY = -T * 0.5f + K * 0.5f; R = CreateBoxPnl.Side("SPO", W, H - K, t, Pos.x, POY, Pos.z, 0, Ry, 0, C[80]); } if (Cat == "Notch") { POY = -T * 0.5f + K * 0.5f; R = CreateBoxPnl.Side("SPN", W, H - K, t, Pos.x, POY, Pos.z, 0, Ry, 0, C[80]); POY = -H * 0.5f + K * 0.5f; RB = CreateBoxPnl.Side("SPK", W - kf, K, t, Pos.x + Nx, POY, Pos.z + Nz, 0, Ry, 0, C[80]); RB.transform.SetParent(BASE.transform); if (C[60].IndexOf("GLOBAL") != -1) RB.tag = "sidePNL"; } if (R != null) { R.transform.SetParent(BASE.transform); if (C[60].IndexOf("GLOBAL") != -1) { R.tag = "sidePNL"; } } } //FINGER GRIP public static void AddFrontEdges(GameObject BASE, string[] C, float W, float e1ay, float e1by, float centerBox_X, float back, float DB) { if (C[78].IndexOf("FG") != -1) { for (int i = 1; i < _G.RTOT + 1; i++) { if (i == 2) { e1ay -= _G.ROWH1[0]; e1by -= _G.ROWH1[0]; } if (i == 3) { e1ay -= _G.ROWH1[1]; e1by -= _G.ROWH1[1]; } if (i == 4) { e1ay -= _G.ROWH1[2]; e1by -= _G.ROWH1[2]; } if (i == 5) { e1ay -= _G.ROWH1[3]; e1by -= _G.ROWH1[3]; } if (i == 6) { e1ay -= _G.ROWH1[4]; e1by -= _G.ROWH1[4]; } GameObject e1a = CreateBoxPnl.Side("e1a" + i.ToString(), W, 1.5f, 0.625f, centerBox_X, e1ay, back - DB + 1.25f - 0.625f * 0.5f, 0, 0, 0, C[69]); e1a.transform.parent = BASE.transform; GameObject e1b = CreateBoxPnl.Side("e1b" + i.ToString(), W, 0.625f, 1.25f, centerBox_X, e1by, back - DB + 1.25f * 0.5f, 0, 0, 0, C[69]); e1b.transform.parent = BASE.transform; } } } }