using UnityEngine; using UnityEngine.Experimental.GlobalIllumination; public class ConstructHood : MonoBehaviour { static GameObject BASE; //static string[] tc; static Material Mat; public static void AddHood(int nO) { string[] C = _G.OBJs[nO]; float W = DOIT.ConvertStringToNumber(C[6]); float H = DOIT.ConvertStringToNumber(C[7]); float D = DOIT.ConvertStringToNumber(C[8]); float px = DOIT.ConvertStringToNumber(C[15]); float py = DOIT.ConvertStringToNumber(C[16]); float pz = DOIT.ConvertStringToNumber(C[17]); float rx = DOIT.ConvertStringToNumber(C[18]); float ry = DOIT.ConvertStringToNumber(C[19]); float rz = DOIT.ConvertStringToNumber(C[20]); //tc = C[61].Split(","[0]); //print("C[61]====from hood====="+C[61]+" object nane===="+C[0]+" model===="+C[1]); //C[61]====from hood===== // // 1?17?2?2?0.75?0.25?2?H object nane====hood30 model====HOOW106 //C[61]====from hood=====#D6B780_Glossy_FLAT object nane====hood43 model====HOOW106 Mat=UIT_MATERIAL.GetMaterial(C[61]); //Texture tex = _G.TEXCABBOX; //float t = 0.625f; _G.SC[4] = C[61]; //create BASE BASE = GameObject.CreatePrimitive(PrimitiveType.Cube);//new GameObject(); BASE.transform.localScale = new(W + +0.5f, H + +0.5f, D + +0.5f); BASE.name = _G.OBJs[nO][0]; BASE.transform.parent = GameObject.Find("SCENE").transform; BASE.tag = "fan"; float back=D*0.5f; float backBox=D*0.5f; float frontBox=D*0.5f; float front=-D*0.5f; float right=W*0.5f; float left=-W*0.5f; float rightBox=W*0.5f; float leftBox=-W*0.5f; float centerBox_X=0; //SPLASH DOBS.SplashC(BASE, C[55], W, H, D, C[54]); //WALLS if (C[1] == "HOOW101") { float ed = 2; float Wt = 10; float ch = 12; float Ht = H - ed - ch; float Dt = 10; float rb = 2; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 PW1 = new(-W / 2 + rb, -H / 2 + ed, -D / 2 + rb); Vector3 PW2 = new(-W / 2 + rb, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2 - rb, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2 - rb, -H / 2 + ed, -D / 2 + rb); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, D / 2 - Dt); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, D / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, D / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, D / 2 - Dt); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOW102") { float ed = 2; float Wt = 10; float ch = 12; float Ht = H - ed - ch; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 PW1 = new(-W / 2, -H / 2 + ed, -D / 2); Vector3 PW2 = new(-W / 2, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2, -H / 2 + ed, -D / 2); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, D / 2 - Dt); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, D / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, D / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, D / 2 - Dt); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOW103") { float ed = 3f; float Wt = 10; float ch = 12;//Center hight float Ht = H - ed - ch; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 B1 = new(-W / 2, -H / 2, -D / 2); Vector3 B2 = new(-W / 2, -H / 2, D / 2); Vector3 B3 = new(W / 2, -H / 2, D / 2); Vector3 B4 = new(W / 2, -H / 2, -D / 2); Vector3 U1 = new(-W / 2, -H / 2 + ed, -D / 2); Vector3 U2 = new(-W / 2, -H / 2 + ed, D / 2); Vector3 U3 = new(W / 2, -H / 2 + ed, D / 2); Vector3 U4 = new(W / 2, -H / 2 + ed, -D / 2); Vector3 T1 = new(-W / 2, -H / 2 + ch + ed, D / 2 - Dt); Vector3 T2 = new(-W / 2, -H / 2 + ch + ed, D / 2); Vector3 T3 = new(W / 2, -H / 2 + ch + ed, D / 2); Vector3 T4 = new(W / 2, -H / 2 + ch + ed, D / 2 - Dt); CreateMesh4("F1", U2, T2, T1, U1, "X"); CreateMesh4("F2", B3, T3, T2, B2, "Z"); CreateMesh4("F3", U3, U4, T4, T3, "X"); CreateMesh4("F4", U1, T1, T4, U4, "Z"); CreateMesh4("F5", B1, U1, U2, B4, "Z"); } if (C[1] == "HOOW104") { float ed = 3f; float Wt = W - 4; float ch = 12;//Center hight float Ht = H - ed - ch; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 B1 = new(-W / 2, -H / 2, -D / 2); Vector3 B2 = new(-W / 2, -H / 2, D / 2); Vector3 B3 = new(W / 2, -H / 2, D / 2); Vector3 B4 = new(W / 2, -H / 2, -D / 2); Vector3 U1 = new(-W / 2, -H / 2 + ed, -D / 2); Vector3 U2 = new(-W / 2, -H / 2 + ed, D / 2); Vector3 U3 = new(W / 2, -H / 2 + ed, D / 2); Vector3 U4 = new(W / 2, -H / 2 + ed, -D / 2); Vector3 T1 = new(-W / 2, -H / 2 + ch + ed, D / 2 - Dt); Vector3 T2 = new(-W / 2, -H / 2 + ch + ed, D / 2); Vector3 T3 = new(W / 2, -H / 2 + ch + ed, D / 2); Vector3 T4 = new(W / 2, -H / 2 + ch + ed, D / 2 - Dt); CreateMesh4("F1", U2, T2, T1, U1, "X"); CreateMesh4("F2", B3, T3, T2, B2, "Z"); CreateMesh4("F3", U3, U4, T4, T3, "X"); CreateMesh4("F4", U1, T1, T4, U4, "Z"); CreateMesh4("F5", B1, U1, U2, B4, "Z"); } if (C[1] == "HOOW105") { float Wt = 10; float Ht = H - 3; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", W, 3, D, 0, -H / 2 + 1.5f, 0); } if (C[1] == "HOOW106") { float Wt = 10; float Ht = H - 3; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", W, 3, D, 0, -H / 2 + 1.5f, 0); CreateCube("B2", W - 12, 3, D - 6, 0, -H / 2 + 4.5f, D / 2 - (W - 12) / 2); } if (C[1] == "HOOW107") { float ed = 3f; float Dt = 12; CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 B1 = new(-W / 2, -H / 2, -D / 2); Vector3 B2 = new(-W / 2, -H / 2, D / 2); Vector3 B3 = new(W / 2, -H / 2, D / 2); Vector3 B4 = new(W / 2, -H / 2, -D / 2); Vector3 U1 = new(-W / 2, -H / 2 + ed, -D / 2); Vector3 U2 = new(-W / 2, -H / 2 + ed, D / 2); Vector3 U3 = new(W / 2, -H / 2 + ed, D / 2); Vector3 U4 = new(W / 2, -H / 2 + ed, -D / 2); Vector3 T1 = new(-W / 2, H / 2, D / 2 - Dt); Vector3 T2 = new(-W / 2, H / 2, D / 2); Vector3 T3 = new(W / 2, H / 2, D / 2); Vector3 T4 = new(W / 2, H / 2, D / 2 - Dt); CreateMesh4("F1", U2, T2, T1, U1, "Z"); CreateMesh4("F2", B3, T3, T2, B2, "X"); CreateMesh4("F3", U3, U4, T4, T3, "Z"); CreateMesh4("F4", U1, T1, T4, U4, "X"); CreateMesh4("F5", B1, U1, U2, B4, "X"); CreateMesh4("Ft", T1, T2, T3, T4, "X"); } if (C[1] == "HOOW108") { float ed = 1f; float Dt = 12; CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 B1 = new(-W / 2, -H / 2, -D / 2); Vector3 B2 = new(-W / 2, -H / 2, D / 2); Vector3 B3 = new(W / 2, -H / 2, D / 2); Vector3 B4 = new(W / 2, -H / 2, -D / 2); Vector3 U1 = new(-W / 2, -H / 2 + ed, -D / 2); Vector3 U2 = new(-W / 2, -H / 2 + ed, D / 2); Vector3 U3 = new(W / 2, -H / 2 + ed, D / 2); Vector3 U4 = new(W / 2, -H / 2 + ed, -D / 2); Vector3 T1 = new(-W / 2, H / 2, D / 2 - Dt); Vector3 T2 = new(-W / 2, H / 2, D / 2); Vector3 T3 = new(W / 2, H / 2, D / 2); Vector3 T4 = new(W / 2, H / 2, D / 2 - Dt); CreateMesh4("F1", U2, T2, T1, U1, "Z"); CreateMesh4("F2", B3, T3, T2, B2, "X"); CreateMesh4("F3", U3, U4, T4, T3, "Z"); CreateMesh4("F4", U1, T1, T4, U4, "X"); CreateMesh4("F5", B1, U1, U2, B4, "X"); CreateMesh4("Ft", T1, T2, T3, T4, "X"); } if (C[1] == "HOOW109") { float ed = 9;//Base height float Wt = 12;//Wide top float Ht = 10;// H - ed;//Height top float Dt = 10; float ch = H - ed - Ht;//Center Height CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("BE1", 2, 1, D, -W / 2 + 1, -H / 2 + 0.5f, 0); CreateCube("BE2", 2, 1, D, W / 2 - 1, -H / 2 + 0.5f, 0); CreateCube("BE3", W - 4, 1, 2, 0, -H / 2 + 0.5f, -D / 2 + 1); CreateCube("B1", W - 2, ed - 1, D - 1, 0, -H / 2 + ed / 2 + 0.5f, 0.5f); CreateCube("E1", W, 1, D, 0, -H / 2 + ed, 0); CreateCube("E2", Wt + 2, 1, Dt + 2, 0, H / 2 - Ht, D / 2 - Dt / 2); CreateCube("E3", Wt + 2, 1, Dt + 2, 0, H / 2 - 1, D / 2 - Dt / 2); Vector3 PW1 = new(-W / 2 + 1, -H / 2 + ed, -D / 2 + 1); Vector3 PW2 = new(-W / 2 + 1, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2 - 1, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2 - 1, -H / 2 + ed, -D / 2 + 1); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, D / 2 - Dt); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, D / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, D / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, D / 2 - Dt); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOW110") { float ed = 8;//Base height float Wt = W;//Wide top float Ht = 0;// H - ed;//Height top float Dt = 10; float ch = H - ed - Ht;//Center Height CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("BE1", 2, 1, D, -W / 2 + 1, -H / 2 + 0.5f, 0); CreateCube("BE2", 2, 1, D, W / 2 - 1, -H / 2 + 0.5f, 0); CreateCube("BE3", W - 4, 1, 2, 0, -H / 2 + 0.5f, -D / 2 + 1); CreateCube("B1", W - 2, ed - 1, D - 1, 0, -H / 2 + ed / 2 + 0.5f, 0.5f); CreateCube("E1", W, 1, D, 0, -H / 2 + ed, 0); CreateCube("E2", Wt, 1, Dt + 2, 0, H / 2 - Ht, D / 2 - Dt / 2); Vector3 PW1 = new(-W / 2 + 1, -H / 2 + ed, -D / 2 + 1); Vector3 PW2 = new(-W / 2 + 1, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2 - 1, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2 - 1, -H / 2 + ed, -D / 2 + 1); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, D / 2 - Dt); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, D / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, D / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, D / 2 - Dt); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOW111") { float ed = 8;//Base height float Wt = W;//Wide top float Ht = 10;// H - ed;//Height top float Dt = 10; float ch = H - ed - Ht;//Center Height CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("BE1", 2, 1, D, -W / 2 + 1, -H / 2 + 0.5f, 0); CreateCube("BE2", 2, 1, D, W / 2 - 1, -H / 2 + 0.5f, 0); CreateCube("BE3", W - 4, 1, 2, 0, -H / 2 + 0.5f, -D / 2 + 1); CreateCube("B1", W - 2, ed - 1, D - 1, 0, -H / 2 + ed / 2 + 0.5f, 0.5f); CreateCube("E1", W, 1, D, 0, -H / 2 + ed, 0); CreateCube("E2", Wt, 1, Dt + 1, 0, H / 2 - Ht, D / 2 - Dt / 2 - 0.5f); CreateCube("E3", Wt, 1, Dt + 1, 0, H / 2 - 1, D / 2 - Dt / 2 - 0.5f); Vector3 PW1 = new(-W / 2 + 1, -H / 2 + ed, -D / 2 + 1); Vector3 PW2 = new(-W / 2 + 1, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2 - 1, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2 - 1, -H / 2 + ed, -D / 2 + 1); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, D / 2 - Dt); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, D / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, D / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, D / 2 - Dt); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOW112") { float ed = 8;//Base height float Wt = 10;//Wide top float Ht = 8;// H - ed;//Height top float Dt = 10; float ch = H - ed - Ht;//Center Height CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, D / 2 - Dt / 2); CreateCube("B", 3, ed, D - 1, -W / 2 + 2.5f, -H / 2 + ed / 2, 0.5f); CreateCube("B", 3, ed, D - 1, W / 2 - 2.5f, -H / 2 + ed / 2, 0.5f); CreateCube("E1", W, 1, D, 0, -H / 2 + ed, 0); CreateCube("E1", Wt + 2, 1, Dt + 2, 0, H / 2 - Ht, D / 2 - Dt / 2); CreateCube("E1", Wt + 2, 1, Dt + 2, 0, H / 2 - 1, D / 2 - Dt / 2); Vector3 PW1 = new(-W / 2 + 1, -H / 2 + ed, -D / 2 + 1); Vector3 PW2 = new(-W / 2 + 1, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2 - 1, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2 - 1, -H / 2 + ed, -D / 2 + 1); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, D / 2 - Dt); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, D / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, D / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, D / 2 - Dt); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); //FRONT Vector3 PF1 = new(-W / 2 + 4, -H / 2 + 2, -D / 2 + 1.5f); Vector3 PF2 = new(-W / 2 + 4, -H / 2 + ed, -D / 2 + 1.5f); Vector3 PF3 = new(0, -H / 2 + ed, -D / 2 + 1.5f); Vector3 PF4 = new(W / 2 - 4, -H / 2 + ed, -D / 2 + 1.5f); Vector3 PF5 = new(W / 2 - 4, -H / 2 + 2, -D / 2 + 1.5f); Vector3 PF6 = new(0, -H / 2 + ed - 3, -D / 2 + 1.5f); CreateMesh4("f1", PF1, PF2, PF3, PF6, "Z"); CreateMesh4("f2", PF6, PF3, PF4, PF5, "Z"); } //CEILLING if (C[1] == "HOOC101") { float ed = 2; float Wt = 10; float ch = 12; float Ht = H - ed - ch; float Dt = 10; float rb = 2; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 PW1 = new(-W / 2 + rb, -H / 2 + ed, -D / 2 + rb); Vector3 PW2 = new(-W / 2 + rb, -H / 2 + ed, D / 2 - rb); Vector3 PW3 = new(W / 2 - rb, -H / 2 + ed, D / 2 - rb); Vector3 PW4 = new(W / 2 - rb, -H / 2 + ed, -D / 2 + rb); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, -Dt / 2); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, -Dt / 2); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOC102") { float ed = 2; float Wt = 10; float ch = 12; float Ht = H - ed - ch; float Dt = 10; float rb = 0; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("B", W, ed, D, 0, -H / 2 + ed / 2, 0); Vector3 PW1 = new(-W / 2 + rb, -H / 2 + ed, -D / 2 + rb); Vector3 PW2 = new(-W / 2 + rb, -H / 2 + ed, D / 2 - rb); Vector3 PW3 = new(W / 2 - rb, -H / 2 + ed, D / 2 - rb); Vector3 PW4 = new(W / 2 - rb, -H / 2 + ed, -D / 2 + rb); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, -Dt / 2); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, -Dt / 2); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOC103") { float Wt = 10; float Ht = H - 3; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("B", W, 3, D, 0, -H / 2 + 1.5f, 0); } if (C[1] == "HOOC104") { float Wt = 10; float Ht = H - 3; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("B", W, 3, D, 0, -H / 2 + 1.5f, 0); CreateCube("B2", W - 12, 3, D - 6, 0, -H / 2 + 4.5f, 0); } if (C[1] == "HOOC105") { float Wt = 10; float Ht = H - 3; float Dt = 10; CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("B", W, 3, D, 0, -H / 2 + 1.5f + 3 / 2, 0); CreateCube("B2", W - 12, 3, D - 6, 0, -H / 2 + 3 / 2, 0); } if (C[1] == "HOOC106") { float ed = 8;//Base height float Wt = 12;//Wide top float Ht = 10;// H - ed;//Height top float Dt = 12; float ch = H - ed - Ht;//Center Height CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("BE1", 2, 1, D, -W / 2 + 1, -H / 2 + 0.5f, 0); CreateCube("BE2", W - 4, 1, 2, 0, -H / 2 + 0.5f, D / 2 - 1); CreateCube("BE3", 2, 1, D, W / 2 - 1, -H / 2 + 0.5f, 0); CreateCube("BE4", W - 4, 1, 2, 0, -H / 2 + 0.5f, -D / 2 + 1); CreateCube("B1", W - 2, ed - 1, D - 2, 0, -H / 2 + ed / 2 + 0.5f, 0); CreateCube("E2", W, 1, D, 0, -H / 2 + ed, 0); CreateCube("E3", Wt + 2, 1, Dt + 2, 0, H / 2 - Ht, 0); CreateCube("E4", Wt + 2, 1, Dt + 2, 0, H / 2 - 1, 0); Vector3 PW1 = new(-W / 2 + 1, -H / 2 + ed, -D / 2 + 1); Vector3 PW2 = new(-W / 2 + 1, -H / 2 + ed, D / 2 - 1); Vector3 PW3 = new(W / 2 - 1, -H / 2 + ed, D / 2 - 1); Vector3 PW4 = new(W / 2 - 1, -H / 2 + ed, -D / 2 + 1); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, -Dt / 2); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, -Dt / 2); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); } if (C[1] == "HOOC107") { W = W - 2; D = D - 2; float ed = 8;//Base height float Wt = 10;//Wide top float Ht = 8;// H - ed;//Height top float Dt = 10; float ch = H - ed - Ht;//Center Height CreateCube("T", Wt, Ht, Dt, 0, H / 2 - Ht / 2, 0); CreateCube("B", 3, ed, 3, -W / 2 + 1.5f, -H / 2 + ed / 2, -D / 2 + 1.5f); CreateCube("B", 3, ed, 3, -W / 2 + 1.5f, -H / 2 + ed / 2, D / 2 - 1.5f); CreateCube("B", 3, ed, 3, W / 2 - 1.5f, -H / 2 + ed / 2, D / 2 - 1.5f); CreateCube("B", 3, ed, 3, W / 2 - 1.5f, -H / 2 + ed / 2, -D / 2 + 1.5f); CreateCube("E1", W + 2, 1, D + 2, 0, -H / 2 + ed, 0); CreateCube("E1", Wt + 2, 1, Dt + 2, 0, H / 2 - Ht, 0); CreateCube("E1", Wt + 2, 1, Dt + 2, 0, H / 2 - 1, 0); Vector3 PW1 = new(-W / 2, -H / 2 + ed, -D / 2); Vector3 PW2 = new(-W / 2, -H / 2 + ed, D / 2); Vector3 PW3 = new(W / 2, -H / 2 + ed, D / 2); Vector3 PW4 = new(W / 2, -H / 2 + ed, -D / 2); Vector3 PU1 = new(-Wt / 2, H / 2 - Ht, -Dt / 2); Vector3 PU2 = new(-Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU3 = new(Wt / 2, H / 2 - Ht, Dt / 2); Vector3 PU4 = new(Wt / 2, H / 2 - Ht, -Dt / 2); CreateMesh4("F1", PW2, PU2, PU1, PW1, "X"); CreateMesh4("F2", PW3, PU3, PU2, PW2, "Z"); CreateMesh4("F3", PW4, PU4, PU3, PW3, "X"); CreateMesh4("F4", PW1, PU1, PU4, PW4, "Z"); //FRONT 1 Vector3 PF1 = new(-W / 2 + 0.5f, -H / 2 + 2, D / 2 - 3); Vector3 PF2 = new(-W / 2 + 0.5f, -H / 2 + ed, D / 2 - 3); Vector3 PF3 = new(-W / 2 + 0.5f, -H / 2 + ed, 0); Vector3 PF4 = new(-W / 2 + 0.5f, -H / 2 + ed, -D / 2 + 3); Vector3 PF5 = new(-W / 2 + 0.5f, -H / 2 + 2, -D / 2 + 3); Vector3 PF6 = new(-W / 2 + 0.5f, -H / 2 + ed - 3, 0); CreateMesh4("f1a", PF1, PF2, PF3, PF6, "Z"); CreateMesh4("f1b", PF6, PF3, PF4, PF5, "Z"); //FRONT 2 PF1 = new(W / 2 - 3, -H / 2 + 2, D / 2 - 0.5f); PF2 = new(W / 2 - 3, -H / 2 + ed, D / 2 - 0.5f); PF3 = new(0, -H / 2 + ed, D / 2 - 0.5f); PF4 = new(-W / 2 + 3, -H / 2 + ed, D / 2 - 0.5f); PF5 = new(-W / 2 + 3, -H / 2 + 2, D / 2 - 0.5f); PF6 = new(0, -H / 2 + ed - 3, D / 2 - 0.5f); CreateMesh4("f2a", PF1, PF2, PF3, PF6, "X"); CreateMesh4("f2b", PF6, PF3, PF4, PF5, "X"); //FRONT 3 PF1 = new(W / 2 - 0.5f, -H / 2 + 2, -D / 2 + 3); PF2 = new(W / 2 - 0.5f, -H / 2 + ed, -D / 2 + 3); PF3 = new(W / 2 - 0.5f, -H / 2 + ed, 0); PF4 = new(W / 2 - 0.5f, -H / 2 + ed, D / 2 - 3); PF5 = new(W / 2 - 0.5f, -H / 2 + 2, D / 2 - 3); PF6 = new(W / 2 - 0.5f, -H / 2 + ed - 3, 0); CreateMesh4("f3a", PF1, PF2, PF3, PF6, "Z"); CreateMesh4("f3b", PF6, PF3, PF4, PF5, "Z"); //FRONT 4 PF1 = new(-W / 2 + 3, -H / 2 + 2, -D / 2 + 0.5f); PF2 = new(-W / 2 + 3, -H / 2 + ed, -D / 2 + 0.5f); PF3 = new(0, -H / 2 + ed, -D / 2 + 0.5f); PF4 = new(W / 2 - 3, -H / 2 + ed, -D / 2 + 0.5f); PF5 = new(W / 2 - 3, -H / 2 + 2, -D / 2 + 0.5f); PF6 = new(0, -H / 2 + ed - 3, -D / 2 + 0.5f); CreateMesh4("f4a", PF1, PF2, PF3, PF6, "X"); CreateMesh4("f4b", PF6, PF3, PF4, PF5, "X"); } //ADD LIGHT SelectLight.AddSpotLight(BASE,H,C[40]); //IMAGE UNDER float PositionY=-H*0.5f+0.4f; if(C[1] == "HOOW112" || C[1] == "HOOC107"){PositionY+=5;} GameObject ImageUnder=GameObject.CreatePrimitive(PrimitiveType.Cube); ImageUnder.name="Imager under"; ImageUnder.transform.localScale=new(W-4,1,D-4); ImageUnder.transform.position=new(0,PositionY,0); Material MaterialHotte= Instantiate(_G.ELEG); Texture2D HotteTexture=Resources.Load("Other/UnderHood"); MaterialHotte.mainTexture=HotteTexture as Texture2D; ImageUnder.GetComponent().material = MaterialHotte; ImageUnder.transform.SetParent(BASE.transform); //ANCHORE POINT CREATE.Point(BASE, "P1", -W / 2, H / 2, D / 2); CREATE.Point(BASE, "P2", W / 2, H / 2, D / 2); CREATE.Point(BASE, "P3", W / 2, H / 2, -D / 2); CREATE.Point(BASE, "P4", -W / 2, H / 2, -D / 2); CREATE.EmptyPoint(BASE, "PBLU", leftBox, (H * 0.5f) , backBox);//P CREATE.EmptyPoint(BASE, "PBRU", rightBox, (H * 0.5f) , backBox);//P2 CREATE.EmptyPoint(BASE, "PFLU", leftBox, (H * 0.5f) , frontBox);//P3 CREATE.EmptyPoint(BASE, "PFRU", rightBox, (H * 0.5f) , frontBox);//P4 CREATE.EmptyPoint(BASE, "PBLB", leftBox, -H * 0.5f, backBox);//P1 CREATE.EmptyPoint(BASE, "PBRB", rightBox, -H * 0.5f, backBox);//P2 CREATE.EmptyPoint(BASE, "PFLB", leftBox, -H * 0.5f, frontBox);//P3 CREATE.EmptyPoint(BASE, "PFRB", rightBox, -H * 0.5f, frontBox);//P4 Mesure.Addpoints("BASE",BASE); //RigidBody BASE.AddComponent(); BASE.GetComponent().useGravity = false; BASE.GetComponent().isKinematic = true; BASE.GetComponent().detectCollisions = true; BASE.GetComponent().isTrigger = true; BASE.transform.position = new(px, py, pz); BASE.transform.localRotation = Quaternion.Euler(rx, ry, rz); BASE.AddComponent(typeof(MoveObject)); BASE.GetComponent().material = Resources.Load("MATERIALS/INVISIBLE") as Material; //BM.INV; } public static void CreateCube(string n, float w, float h, float d, float px, float py, float pz) { GameObject obj = GameObject.CreatePrimitive(PrimitiveType.Cube); obj.GetComponent().enabled = false; obj.transform.localScale = new(w, h, d); obj.transform.position = new(px, py, pz); obj.tag = "fan"; obj.name = n; obj.transform.SetParent(BASE.transform); SetText(obj, w, h, 90); } public static void SetText(GameObject O, float w, float h, int R) { O.GetComponent().material=Mat; O.GetComponent().probeAnchor = GameObject.Find("Reflection Probe").transform; // tc[0] = tc[0].Replace("DCAB", "WOOD"); // //print("===="+tc[0]); // O.GetComponent().material = Resources.Load("MATERIALS/STAINLESS") as Material; // Texture2D T = Resources.Load("TEXTURES/HOOD/" + tc[0]) as Texture2D; // if (R == 90) { T = DOIT.Rotate(T); } // if (tc[0] != "TEXT101") O.GetComponent().material.mainTexture = T; // O.GetComponent().material.color = DOIT.CSc(tc[2], 255); // O.GetComponent().probeAnchor = GameObject.Find("Reflection Stainless").transform; // float GL = 0.1f; // float Sm = 0.5f; // if (tc[2] == "C1C0C0" || tc[2] == "575454" || tc[2] == "D49883" || tc[2] == "D4BA83") // { // GL = 0.9f; // Sm = 0.5f; // O.GetComponent().probeAnchor = GameObject.Find("Reflection Stainless").transform; // } // if (tc[2] == "ffffff") Sm = 0.1f; // O.GetComponent().material.SetFloat("_Glossiness", GL); // O.GetComponent().material.SetFloat("_Metallic", Sm); // DOIT.SetSizeTex(O, 24, 24, 0, 0, 0, 0, 90, 90); } private static void CreateMesh4(string Name, Vector3 P1, Vector3 P2, Vector3 P3, Vector3 P4, string axe) { GameObject s = new GameObject(); s.name = Name; s.AddComponent(typeof(MeshFilter)); s.AddComponent(typeof(MeshRenderer)); s.GetComponent().mesh = CreateMesh4(s, P1, P2, P3, P4, axe); Bounds bounds = s.GetComponent().mesh.bounds; float w = bounds.size.x; float h = bounds.size.y; if (axe == "Z") w = bounds.size.x; h = bounds.size.y; if (axe == "Y") w = bounds.size.x; h = bounds.size.z; if (axe == "X") w = bounds.size.z; h = bounds.size.y; SetText(s, w, h, 0); s.transform.SetParent(BASE.transform); } private static Mesh CreateMesh4(GameObject OBJ, Vector3 P1, Vector3 P2, Vector3 P3, Vector3 P4, string axe) { Mesh mesh = OBJ.GetComponent().mesh; mesh.Clear(); mesh.vertices = new[] { P1, P2, P3, P4 }; Vector2[] uvs = new Vector2[4]; Bounds bounds = mesh.bounds; int i = 0; while (i < uvs.Length) { if (axe == "Z") uvs[i] = new Vector2(mesh.vertices[i].x / bounds.size.x, mesh.vertices[i].y / bounds.size.y); if (axe == "Y") uvs[i] = new Vector2(mesh.vertices[i].x / bounds.size.x, mesh.vertices[i].z / bounds.size.z); if (axe == "X") uvs[i] = new Vector2(mesh.vertices[i].z / bounds.size.z, mesh.vertices[i].y / bounds.size.y); i++; } mesh.uv = uvs; mesh.triangles = new int[6] { 0, 1, 2, 0, 2, 3 }; Vector3[] normals = new Vector3[4] { Vector3.forward, Vector3.forward, Vector3.forward, Vector3.forward }; mesh.normals = normals; mesh.RecalculateNormals(); return mesh; } }