public void CopySelected() { if (selected == null) { return; } { copy = new EditorBodyPart(selected.containedBodyPart, selected.bodyPartRect, selected.angle); } }
//Also decide how to display the stat view! public void PopulateAnatomyView() { for (int i = 0; i < anatomyEditorParent.transform.childCount; i++) { Destroy(anatomyEditorParent.transform.GetChild(i).gameObject); } for (int i = 0; i < CreatureDesigner.selected.bodyParts.Count; i++) { //Here we need to instantiate them EditorBodyPart bodyPart = CreatureDesigner.selected.bodyParts[i]; GameObject instance = Instantiate(bodyPartPrefab, anatomyEditorParent.transform); instance.GetComponent <AnatomyListItem>().index = i; instance.GetComponent <RectTransform>().localPosition = new Vector3(bodyPart.bodyPartRect.x, bodyPart.bodyPartRect.y, 0); instance.GetComponent <RectTransform>().sizeDelta = new Vector2(bodyPart.bodyPartRect.width, bodyPart.bodyPartRect.height); instance.GetComponent <RectTransform>().rotation = Quaternion.Euler(0, 0, bodyPart.angle); if (selected == bodyPart) { instance.GetComponent <Image>().color = new Color32(95, 126, 164, 255); } } //Basically loop through the editorbodyparts and place bodyPartPrefabs at their locations. //Also if we're gonna add a click-to-place thing then make sure to check if we're clicking on a existing part or just on a blank spot! }