public object Clone() { MyPlanetSurfaceRule clonedRule = new MyPlanetSurfaceRule(); clonedRule.Height = Height; clonedRule.Latitude = Latitude; clonedRule.Longitude = Longitude; clonedRule.Slope = Slope; return(clonedRule); }
public MyPlanetEnvironmentMapping(PlanetEnvironmentItemMapping map) { Rule = map.Rule; Items = new MyMaterialEnvironmentItem[map.Items.Length]; if (Items.Length <= 0) { CumulativeIntervals = null; TotalFrequency = 0; return; } TotalFrequency = 0; for (int i = 0; i < map.Items.Length; i++) { var item = map.Items[i]; MyObjectBuilderType type; if (item.TypeId != null && MyObjectBuilderType.TryParse(item.TypeId, out type)) { if (!typeof(MyObjectBuilder_BotDefinition).IsAssignableFrom((Type)type) && !typeof(MyObjectBuilder_VoxelMapStorageDefinition).IsAssignableFrom((Type)type) && !typeof(MyObjectBuilder_EnvironmentItems).IsAssignableFrom((Type)type)) { MyLog.Default.WriteLine(String.Format("Object builder type {0} is not supported for environment items.", item.TypeId)); Items[i].Frequency = 0; // This should disable this item } else { Items[i] = new MyMaterialEnvironmentItem() { Definition = new MyDefinitionId(type, item.SubtypeId), Frequency = map.Items[i].Density, IsDetail = map.Items[i].IsDetail, IsBot = typeof(MyObjectBuilder_BotDefinition).IsAssignableFrom((Type)type), IsVoxel = typeof(MyObjectBuilder_VoxelMapStorageDefinition).IsAssignableFrom((Type)type), IsEnvironemntItem = typeof(MyObjectBuilder_EnvironmentItems).IsAssignableFrom((Type)type), BaseColor = map.Items[i].BaseColor, ColorSpread = map.Items[i].ColorSpread, MaxRoll = (float)Math.Cos(MathHelper.ToDegrees(map.Items[i].MaxRoll)), Offset = map.Items[i].Offset, GroupId = map.Items[i].GroupId, GroupIndex = map.Items[i].GroupIndex, ModifierId = map.Items[i].ModifierId, ModifierIndex = map.Items[i].ModifierIndex }; } } else { MyLog.Default.WriteLine(String.Format("Object builder type {0} does not exist.", item.TypeId)); Items[i].Frequency = 0; // This should disable this item } } ComputeDistribution(); }
public object Clone() { MyPlanetSurfaceRule clonedRule = new MyPlanetSurfaceRule(); clonedRule.Height = Height; clonedRule.Latitude = Latitude; clonedRule.Longitude = Longitude; clonedRule.Slope = Slope; return clonedRule; }