// Start is called before the first frame update void Start() { for (int i = 0; i < furnitureData.Count; i++) { FurnitureBlock block = MakeBlock(i); block.transform.SetParent(sampleContent.transform); } userCategory.SetActive(false); }
public static int create_dsg(bool rot, bool pos, int resol, List <int> color, SubsystemTerrain ter, string name) { var design = (FurnitureDesign)null; var valuesDictionary = new Dictionary <Point3, int>(); var point1 = new Point3(0, 0, 0); var point2 = new Point3(0, 0, 0); for (int x = 0; x < resol; x++) { for (int y = 0; y < resol; y++) { if (pos) { if (rot) { valuesDictionary.Add(new Point3(0, y, x), color[(x + y * resol)]); } else { valuesDictionary.Add(new Point3(x, y, 0), color[(x + y * resol)]); } } else { valuesDictionary.Add(new Point3(x, 0, y), color[(x + y * resol)]); } } } design = new FurnitureDesign(ter); var resolution = resol; var values = new int[resolution * resolution * resolution]; foreach (var keyValuePair in valuesDictionary) { var point3_2 = keyValuePair.Key - point1; values[point3_2.X + point3_2.Y * resolution + point3_2.Z * resolution * resolution] = keyValuePair.Value; } design.SetValues(resolution, values); design.Name = name; FurnitureDesign dsg = ter.SubsystemFurnitureBlockBehavior.TryAddDesign(design); var num = Terrain.MakeBlockValue(227, 0, FurnitureBlock.SetDesignIndex(0, dsg.Index, dsg.ShadowStrengthFactor, false)); return(num); }