public void Draw() { if (output == null) { return; } if (group == null) { return; } undrawn = false; for (int y = 0; y < depth; y++) { for (int x = 0; x < width; x++) { if (rendering[x, y] == null) { string v = model.Sample(x, y); int rot = 0; GameObject fab = null; if (v != "?") { rot = int.Parse(v.Substring(0, 1)); v = v.Substring(1); if (!obmap.ContainsKey(v)) { fab = (GameObject)Resources.Load(v, typeof(GameObject)); obmap[v] = fab; } else { fab = obmap[v]; } if (fab == null) { continue; } Vector3 pos = new Vector3(x * gridsize, y * gridsize, 0f); GameObject tile = (GameObject)Instantiate(fab, new Vector3(), Quaternion.identity); Vector3 fscale = tile.transform.localScale; tile.transform.parent = group; tile.transform.localPosition = pos; tile.transform.localEulerAngles = new Vector3(0, 0, 360 - (rot * 90)); tile.transform.localScale = fscale; rendering[x, y] = tile; } else { undrawn = true; } } } } }
public void Draw() { if (output == null) { return; } if (group == null) { return; } undrawn = false; for (int y = 0; y < depth; y++) { for (int x = 0; x < width; x++) { if (rendering[x, y] == null) { string v = model.Sample(x, y); int rot = 0; if (v != "?") { rot = int.Parse(v.Substring(0, 1)); Vector3 pos = new Vector3(x * gridsize, y * gridsize, 0f); GameObject tile = InstantiateGameObject(v, pos, new Vector3(0, 0, 360 - (rot * 90))); if (tile == null) { continue; } rendering[x, y] = tile; } else { undrawn = true; } } } } }