public void AttachMultiblock(Multiblock m) { if (!_multiblocks.Contains(m)) { _multiblocks.Add(m); OnContainerUpdated(); } }
public void RegisterSmallMultiblock(Multiblock mb, Vector3 pos) { if (_smallMultiblocks.ContainsKey(pos)) { Object.Destroy(_smallMultiblocks[pos].gameObject); } _smallMultiblocks[pos] = mb; }
private void UpdateModel() { if (Crop != null) { Object.Destroy(Crop.gameObject); } if (Stage != 0) { Crop = MultiblockLoader.LoadMultiblock(Type.GrowStages[_stage], Position + new Vector3(-0.5f, 0.5f, -0.5f), _parent, 1); } }
private Multiblock CreateMultiblock(List <VData> list, string name) { var dict = new Dictionary <VoxelMaterial, List <Vector3> >(); foreach (var data in list) { var color = MaterialRegistry.Instance.GetColorIndex(new Color(data.Color.X / 256f, data.Color.Y / 256f, data.Color.Z / 256f)); if (!dict.ContainsKey(color)) { dict.Add(color, new List <Vector3>()); } dict[color].Add(new Vector3(data.VPos.X, data.VPos.Y, data.VPos.Z)); } return(Multiblock.InstantiateVoxels(new Vector3(-1, 0, 0), dict, name)); }
private void Initialize(TreeConfig config, Vector3 position) { var voxels = new Dictionary <VoxelMaterial, List <Vector3> >(); var data = GetRandomizedTreeValues(config); Position = position; var strainVoxels = GenerateStrain(data); voxels.Add(MaterialRegistry.Instance.GetMaterialFromName(config.StainMaterial), strainVoxels); var topOfStain = new Vector3(-data.TreeTopDia / 2f + (data.TreeStainDia) / 2f, data.TreeStainHeight, -data.TreeTopDia / 2f + (data.TreeStainDia) / 2f); var treeTopVoxels = GenerateTreeTop(topOfStain, data); voxels.Add(MaterialRegistry.Instance.GetMaterialFromName(config.LeafMaterial), treeTopVoxels); Multiblock = Multiblock.InstantiateVoxels(position, voxels, "Tree"); Multiblock.EnableWind(1); }