Пример #1
0
    public VoxelVisualComponent(VoxelCell coreCell, GroundQuad quad, bool onTopHalf)
    {
        Core      = coreCell;
        Quad      = quad;
        OnTopHalf = onTopHalf;
        VoxelCell bottomCell = onTopHalf ? coreCell : (coreCell.CellBelow ?? coreCell);
        VoxelCell topCell    = onTopHalf ? (coreCell.CellAbove ?? coreCell) : coreCell;

        bottomLayer     = new VoxelVisualsLayer(bottomCell, quad);
        topLayer        = new VoxelVisualsLayer(topCell, quad);
        ContentPosition = coreCell.CellPosition + (onTopHalf ? new Vector3(0, .5f, 0) : Vector3.zero);
    }
Пример #2
0
    public void InitializeNeighbors()
    {
        VoxelVisualsLayer    layer   = OnTopHalf ? topLayer : bottomLayer;
        VoxelVisualComponent up      = GetUpNeighbor();
        VoxelVisualComponent down    = GetDownNeighbor();
        VoxelVisualComponent left    = layer.AdjacentCellA.Visuals.GetComponent(Quad, OnTopHalf);
        VoxelVisualComponent right   = GetHorizontalNeighbor(layer.AdjacentCellA.GroundPoint, layer.AdjacentCellB.GroundPoint);
        VoxelVisualComponent forward = layer.AdjacentCellB.Visuals.GetComponent(Quad, OnTopHalf);
        VoxelVisualComponent back    = GetHorizontalNeighbor(layer.AdjacentCellB.GroundPoint, layer.AdjacentCellA.GroundPoint);

        Neighbors = new NeighborComponents(up, down, forward, back, left, right);
    }
Пример #3
0
 private bool[,] GetDesignationLayer(VoxelVisualsLayer bottomLayer)
 {
     bool[,] ret = new bool[2, 2];
     ret[0, 0]   = bottomLayer.BasisCell.Filled;
     ret[1, 0]   = bottomLayer.BasisCell.Filled && bottomLayer.AdjacentCellA.Filled;
     ret[0, 1]   = bottomLayer.BasisCell.Filled && bottomLayer.AdjacentCellB.Filled;
     ret[1, 1]   = bottomLayer.BasisCell.Filled &&
                   bottomLayer.DiagonalCell.Filled &&
                   bottomLayer.AdjacentCellA.Filled &&
                   bottomLayer.AdjacentCellB.Filled;
     return(ret);
 }