public VisualsSolvingManager(MainGrid grid, OptionsByDesignation optionsSource) { currentSolver = new VisualsSolver(grid, optionsSource); lastSolution = currentSolver.FirstState; thread = new Thread(MainLoop); thread.Start(); }
public VoxelOptionSolver(VoxelVisualComponent startingComponent, MainGrid grid, OptionsByDesignation optionsSource) { SolverState initialState = new SolverState(); VoxelOptionSolver solver = new VoxelOptionSolver(startingComponent, initialState); this.grid = grid; this.optionsSource = optionsSource; }
private SolutionState(IReadOnlyDictionary <VoxelVisualComponent, CellState> cellStateLookup, OptionsByDesignation optionsSource) { this.cellStateLookup = cellStateLookup; this.optionsSource = optionsSource; foreach (CellState item in Cells) { item.SetStatus(this); } IsEverythingSolved = Cells.All(item => item.Status != CellStatus.InvalidAndCanDrop); }
public VisualsSolver(MainGrid grid, OptionsByDesignation optionsSource) { SolutionState initialState = new SolutionState(grid, optionsSource); StateHistory = new List <SolutionState>() { initialState }; Status = GetSolverStatus(); }
private void Start() { MainGrid = LoadLastSave ? GroundLoader.Load() : GroundLoader.Load(DefaultGridFile.text); InteractionMesh = new InteractionMesh(new Mesh()); UpdateInteractionGrid(); InteractionMeshObject.GetComponent <MeshFilter>().mesh = InteractionMesh.Mesh; BaseGridVisual.GetComponent <MeshFilter>().mesh = CloneInteractionMesh(); optionsSource = new OptionsByDesignation(VoxelBlueprints); visualsAssembler = new VoxelVisualsManager(VoxelDisplayMat, optionsSource); solver = new VisualsSolvingManager(MainGrid, optionsSource); }
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); }
public SolutionState(MainGrid grid, OptionsByDesignation optionsSource) { this.optionsSource = optionsSource; cellStateLookup = GetInitialDictionary(grid, optionsSource); IsEverythingSolved = false; }
public VoxelVisualsManager(Material voxelDisplayMat, OptionsByDesignation optionsSource) { piecesRoot = new GameObject("Pieces Root").transform; this.voxelDisplayMat = voxelDisplayMat; this.optionsSource = optionsSource; }