using System.Collections; using System.Collections.Generic; using UnityEngine; public class ConstructMirrors : MonoBehaviour { public static void AddMirrors(int nO) { print("CONTRUCT MIRRORS__________________________________________________________" + 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]); Material MatA=UIT_MATERIAL.GetMaterial(C[60]); // Color colA = DOIT.CSc(C[60]); // Color colB = DOIT.CSc(C[61]); // Color colC = DOIT.CSc(C[62]); //create BASE GameObject BASE = GameObject.CreatePrimitive(PrimitiveType.Cube);//new GameObject(); BASE.transform.localScale = new Vector3(w + 0.2f, h + 2, d + 2); BASE.name = C[0]; BASE.transform.parent = GameObject.Find("SCENE").transform; print("C[1]====="+C[1]); //Model GameObject T = Instantiate(Resources.Load("Mirrors/" + C[1], typeof(GameObject))) as GameObject; T.transform.localScale = new Vector3(1.0f, 1.0f, 1.0f); T.name = "T1"; T.transform.parent = BASE.transform; T.transform.localRotation = Quaternion.Euler(0, 180, 0); GameObject TA = T.transform.Find("A").gameObject; GameObject TB = T.transform.Find("B").gameObject; GameObject TC = T.transform.Find("C").gameObject; for (int i = 0; i < TA.transform.childCount; i++) { TA.transform.GetChild(i).GetComponent().material = Resources.Load("MATERIALS/ST") as Material; // TA.transform.GetChild(i).GetComponent().material.SetFloat("_Metallic", 0.2F); TA.transform.GetChild(i).GetComponent().material.SetFloat("_Glossiness", 0.5F); } for (int i = 0; i < TB.transform.childCount; i++) { TB.transform.GetChild(i).GetComponent().material = Resources.Load("MATERIALS/INVISIBLE") as Material; //BM.CHROME; TB.transform.GetChild(i).GetComponent().probeAnchor = GameObject.Find("Reflection Probe ext").transform; //TB.transform.GetChild(i).GetComponent().material.SetFloat("_Metallic", 0.1F); // TB.transform.GetChild(i).GetComponent().material.SetFloat("_Glossiness", 0.8F); } for (int i = 0; i < TC.transform.childCount; i++) { TC.transform.GetChild(i).GetComponent().material = Resources.Load("MATERIALS/STAINLESS") as Material; //BM.STAINLESS; TC.transform.GetChild(i).GetComponent().material.SetFloat("_Metallic", 1F); TC.transform.GetChild(i).GetComponent().material.SetFloat("_Glossiness", 1F); TC.transform.GetChild(i).GetComponent().probeAnchor = GameObject.Find("Reflection Probe").transform; } Mesure.Addpoints("BASE",BASE); //Stet in scene BASE.transform.position = new Vector3(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; } }