void Traversal(Transform t) { for (int i = 0; i < t.childCount; i++) { Transform tt = t.GetChild(i); if (tt.GetComponent <Light>() != null) { Light l = tt.GetComponent <Light>(); Mlight mlight = new Mlight(); mlight.Name = l.type.ToString(); mlight.Intensity = l.intensity; mlight.Range = l.range; mlight.SpotAngle = l.spotAngle; mlight.CookieSize = l.cookieSize; mlight.x = l.transform.position.x; mlight.y = l.transform.position.y; mlight.z = l.transform.position.z; mlight.r = l.color.r; mlight.g = l.color.g; mlight.b = l.color.b; mlight.a = l.color.a; mlight.rx = l.transform.rotation.x; mlight.ry = l.transform.rotation.y; mlight.rz = l.transform.rotation.z; mlight.rw = l.transform.rotation.w; mTerrain.Add(mlight); } else { MCube mcube = new MCube(); mcube.Name = tt.name; mcube.x = tt.position.x; mcube.y = tt.position.y; mcube.z = tt.position.z; mcube.rx = tt.rotation.x; mcube.ry = tt.rotation.y; mcube.rz = tt.rotation.z; mcube.rw = tt.rotation.w; mcube.parent = tt.parent.name; mTerrain.Add(mcube); } Traversal(tt); } }
public void Add(Mlight zone) { lights_.Add(zone); }