public void Assembling_Draft() { SendDestroyMessage(); GameObject elem_prefab = Resources.Load("Elements/DraftElement") as GameObject; Transform Plate = Instantiate((Resources.Load("Elements/DraftPlate") as GameObject).transform, new Vector3(PP.Width / 2, -0.5f, PP.Height / 2), Quaternion.identity) as Transform; NewPlate(Plate); Transform Elem; for (int i = 0; i < DataStorage.N; i++) { CircuitElement t = DataStorage.cm[i]; Elem = Instantiate(elem_prefab.transform) as Transform; Elem.Find("Scale").transform.localScale = new Vector3(t.Width - 3, t.Height - 3, 1); Elem.parent = Rotator; Elem.localPosition = new Vector3(t.x + t.Width / 2, t.y + t.Height / 2, 0); Elem.localEulerAngles = Vector3.zero; Elem.gameObject.name = i.ToString(); Elem.Find("Label").GetComponent <TextMesh>().text = DataStorage.cm[i].Name; } HiResScreenShots.TakeHiResShot(new Vector3(PP.Width / 2, PP.Height / 2)); SaveButton.interactable = false; }
private void ShowElements() { SendDestroyMessage(); Transform Plate = Instantiate(Plate_prefab) as Transform; NewPlate(Plate); Transform Elem; List <GameObject> lst = new List <GameObject>(); foreach (string caseName in DataStorage.caseNames) { lst.Add(Resources.Load("Elements/" + caseName) as GameObject); } for (int i = 0; i < DataStorage.N; i++) { Elem = Instantiate(lst[DataStorage.caseNames.IndexOf(DataStorage.cm[i].CaseName)].transform) as Transform; Elem.parent = Rotator; Elem.localPosition = new Vector3(DataStorage.cm[i].x + DataStorage.cm[i].Width / 2, DataStorage.cm[i].y + DataStorage.cm[i].Height / 2, 0); // make it at the position of the spawner Elem.localEulerAngles = Vector3.zero; //default angle if (DataStorage.cm[i].isVertical == true) { Elem.localEulerAngles = new Vector3(Elem.rotation.x, Elem.rotation.y, Elem.rotation.z + 90); } Elem.gameObject.name = i.ToString(); Elem.Find("Label").GetComponent <TextMesh>().text = DataStorage.cm[i].Name; T = false; } }