public GroundDataInfo ToGroundDataInfo() { GroundDataInfo data = new GroundDataInfo (); data.m_Sprite = GetComponent<SpriteRenderer> ().sprite; data.m_Position = transform.localPosition; data.m_Scale = transform.localScale; data.m_Rotation = transform.localRotation; return data; }
public GroundDataInfo ToGroundDataInfo() { GroundDataInfo data = new GroundDataInfo(); data.m_Sprite = GetComponent <SpriteRenderer> ().sprite; data.m_Position = transform.localPosition; data.m_Scale = transform.localScale; data.m_Rotation = transform.localRotation; return(data); }
void CreateGround(GameObject mapContainer, List <GroundDataInfo> aGroundDataInfo) { GameObject container = new GameObject(); container.name = "GroundContainer"; container.transform.SetParent(mapContainer.transform, false); for (int i = 0; i < aGroundDataInfo.Count; i++) { GroundDataInfo groundDataInfo = aGroundDataInfo[i]; GameObject ground = new GameObject(); ground.name = GROUND_NAME + i; ground.transform.SetParent(container.transform, false); SpriteRenderer spriteRenderer = ground.AddComponent <SpriteRenderer>(); spriteRenderer.sprite = groundDataInfo.m_Sprite; ground.transform.localPosition = groundDataInfo.m_Position; ground.transform.localScale = groundDataInfo.m_Scale; ground.transform.localRotation = groundDataInfo.m_Rotation; } }