Exemple #1
0
        public SolutionState GetWithChangedCell(VoxelCell changedCell)
        {
            Dictionary <VoxelVisualComponent, CellState> newLookup = cellStateLookup.ToDictionary(item => item.Key, item => item.Value);

            foreach (VoxelVisualComponent component in changedCell.Visuals.Components)
            {
                VoxelVisualOption[] options = optionsSource.GetOptions(component.GetCurrentDesignation());
                newLookup[component] = new CellState(options, component);
            }
            foreach (VoxelVisualComponent component in changedCell.GetConnectedCells().SelectMany(item => item.Visuals.Components))
            {
                VoxelVisualOption[] options = optionsSource.GetOptions(component.GetCurrentDesignation());
                newLookup[component] = new CellState(options, component);
            }
            return(new SolutionState(newLookup, optionsSource));
        }
 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);
     }
 }
Exemple #3
0
        private Dictionary <VoxelVisualComponent, CellState> GetInitialDictionary(MainGrid grid, OptionsByDesignation optionsSource)
        {
            Dictionary <VoxelVisualComponent, CellState> ret = new Dictionary <VoxelVisualComponent, CellState>();

            foreach (VoxelVisualComponent component in grid.Voxels.SelectMany(item => item.Visuals.Components))
            {
                VoxelVisualOption[] options = optionsSource.GetOptions(component.GetCurrentDesignation());
                CellState           state   = new CellState(options, component);
                ret.Add(component, state);
            }
            return(ret);
        }