コード例 #1
0
 public VisualsSolvingManager(MainGrid grid, OptionsByDesignation optionsSource)
 {
     currentSolver = new VisualsSolver(grid, optionsSource);
     lastSolution  = currentSolver.FirstState;
     thread        = new Thread(MainLoop);
     thread.Start();
 }
コード例 #2
0
    public VoxelOptionSolver(VoxelVisualComponent startingComponent, MainGrid grid, OptionsByDesignation optionsSource)
    {
        SolverState       initialState = new SolverState();
        VoxelOptionSolver solver       = new VoxelOptionSolver(startingComponent, initialState);

        this.grid          = grid;
        this.optionsSource = optionsSource;
    }
コード例 #3
0
 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);
 }
コード例 #4
0
            public VisualsSolver(MainGrid grid, OptionsByDesignation optionsSource)
            {
                SolutionState initialState = new SolutionState(grid, optionsSource);

                StateHistory = new List <SolutionState>()
                {
                    initialState
                };
                Status = GetSolverStatus();
            }
コード例 #5
0
 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);
 }
コード例 #6
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);
        }
コード例 #7
0
 public SolutionState(MainGrid grid, OptionsByDesignation optionsSource)
 {
     this.optionsSource = optionsSource;
     cellStateLookup    = GetInitialDictionary(grid, optionsSource);
     IsEverythingSolved = false;
 }
コード例 #8
0
 public VoxelVisualsManager(Material voxelDisplayMat, OptionsByDesignation optionsSource)
 {
     piecesRoot           = new GameObject("Pieces Root").transform;
     this.voxelDisplayMat = voxelDisplayMat;
     this.optionsSource   = optionsSource;
 }