示例#1
0
 void CreateCellsWithOneValue(IEnumerable <Util.Tuple <Cell, CellValue> > cells, TerrainManager.CellValue cellValue)
 {
     foreach (Util.Tuple <Cell, CellValue> cv in cells)
     {
         terrain.SetCellValue(cv.first, cellValue);
     }
 }
示例#2
0
    void EndCreate()
    {
        operating = false;

        HashSet <Util.Tuple <Cell, CellValue> > copyOfCandidates = new HashSet <Util.Tuple <Cell, CellValue> >(operationCandidates);

        TerrainManager.CellValue cellValue = new TerrainManager.CellValue(
            terrainToolSettings.GetBlockShape(),
            terrainToolSettings.GetBlockDirection(),
            terrainToolSettings.GetBlockStyle());


        undoStack.Push(new UndoStack.Item
        {
            actionLabel           = $"Creating blocks",
            getUnableToDoReason   = () => null,
            getUnableToUndoReason = () => null,
            doIt = () => CreateCellsWithOneValue(copyOfCandidates, cellValue),
            undo = () => CreateCells(copyOfCandidates)
        });

        createTerrainPreview.ClearCreationPreview();
        operationCandidates.Clear();
    }