public VoxelDesignation GetCurrentDesignation() { bool[,] bottomDesignationLayer = GetDesignationLayer(bottomLayer); bool[,] topDesignationLayer = GetDesignationLayer(topLayer); VoxelDesignation designation = new VoxelDesignation(); if (OnTopHalf) { // bottom goes straignt in, top is AND designation.Description[0, 0, 0] = bottomDesignationLayer[0, 0]; designation.Description[1, 0, 0] = bottomDesignationLayer[1, 0]; designation.Description[0, 0, 1] = bottomDesignationLayer[0, 1]; designation.Description[1, 0, 1] = bottomDesignationLayer[1, 1]; designation.Description[0, 1, 0] = bottomDesignationLayer[0, 0] && topDesignationLayer[0, 0]; designation.Description[1, 1, 0] = bottomDesignationLayer[1, 0] && topDesignationLayer[1, 0]; designation.Description[0, 1, 1] = bottomDesignationLayer[0, 1] && topDesignationLayer[0, 1]; designation.Description[1, 1, 1] = bottomDesignationLayer[1, 1] && topDesignationLayer[1, 1]; } else { // top goes straignt in, bottom is AND designation.Description[0, 0, 0] = bottomDesignationLayer[0, 0] && topDesignationLayer[0, 0]; designation.Description[1, 0, 0] = bottomDesignationLayer[1, 0] && topDesignationLayer[1, 0]; designation.Description[0, 0, 1] = bottomDesignationLayer[0, 1] && topDesignationLayer[0, 1]; designation.Description[1, 0, 1] = bottomDesignationLayer[1, 1] && topDesignationLayer[1, 1]; designation.Description[0, 1, 0] = topDesignationLayer[0, 0]; designation.Description[1, 1, 0] = topDesignationLayer[1, 0]; designation.Description[0, 1, 1] = topDesignationLayer[0, 1]; designation.Description[1, 1, 1] = topDesignationLayer[1, 1]; } return(designation); }
private void UpdateVoxel(VoxelCell targetCell) { foreach (VoxelVisualComponent component in targetCell.Visuals.Components) { VoxelDesignation designation = component.GetCurrentDesignation(); VoxelVisualOption option = optionsSource.GetOptions(designation).First(); component.Contents = option; UpdateDebugObject(component); } }
private void RemoveVoxelDesignation(VoxelDesignation D) { var key = GetVoxelQuickCompare(D.Voxel); if (!VoxelDesignations.ContainsKey(key)) { return; } var list = VoxelDesignations[key]; list.Remove(D); if (list.Count == 0) { VoxelDesignations.Remove(key); } }
public IEnumerable <VoxelVisualOption> GenerateVisualOptions() { VoxelVisualConnections baseConnections = new VoxelVisualConnections(Up, Down, PositiveX, NegativeX, PositiveZ, NegativeZ); VoxelDesignation baseDesignation = new VoxelDesignation(DesignationValues); IEnumerable <GeneratedVoxelDesignation> variants = baseDesignation.GetUniqueVariants(); int priority = 0; yield return(new VoxelVisualOption(ArtContent, baseDesignation.Description, false, 0, priority, baseConnections)); foreach (GeneratedVoxelDesignation variant in variants) { priority++; VoxelVisualConnections connectionsVariant = baseConnections.GetVarient(variant.WasFlipped, variant.Rotations); yield return(new VoxelVisualOption(ArtContent, variant.Description, variant.WasFlipped, variant.Rotations, priority, connectionsVariant)); } }
private void SetUpBlueprints() { for (int i = 0; i < invariants.Count; i++) { VoxelBlueprint blueprint = Blueprints[i]; VoxelDesignation invariant = invariants[i]; blueprint.DesignationValues = invariant.GetFlatValues(); if (ArtContent[i] != null) { blueprint.ArtContent = ArtContent[i].GetComponent <MeshFilter>().sharedMesh; } else { blueprint.ArtContent = null; } } }
internal void SetBlueprint(VoxelDesignation item) { Name = item.ToString(); int index = 0; for (int x = 0; x < 2; x++) { for (int y = 0; y < 2; y++) { for (int z = 0; z < 2; z++) { bool val = item.Description[x, y, z]; Indicators[index].SetActive(val); index++; } } } }
public VoxelVisualOption[] GetOptions(VoxelDesignation designation) { return(optionsByDesignationKey[designation.Key]); }