DeleteSprites() public method

public DeleteSprites ( int layerId, int x0, int y0, int x1, int y1 ) : void
layerId int
x0 int
y0 int
x1 int
y1 int
return void
Example #1
0
    void Erase()
    {
        if (editorData.editMode == tk2dTileMapEditorData.EditMode.Paint)
        {
            int x0 = Mathf.Min(cursorX, cursorX0);
            int x1 = Mathf.Max(cursorX, cursorX0);
            int y0 = Mathf.Min(cursorY, cursorY0);
            int y1 = Mathf.Max(cursorY, cursorY0);

            tileMap.DeleteSprites(editorData.layer, x0, y0, x1, y1);
            host.BuildIncremental();
        }
    }
Example #2
0
    void RectangleDragEnd()
    {
        if (!pencilDragActive)
        {
            return;
        }

        if (tk2dTileMapToolbar.mainMode == tk2dTileMapToolbar.MainMode.Brush || tk2dTileMapToolbar.mainMode == tk2dTileMapToolbar.MainMode.BrushRandom)
        {
            SplatWorkingBrush();
        }
        if (tk2dTileMapToolbar.mainMode == tk2dTileMapToolbar.MainMode.Eyedropper ||
            tk2dTileMapToolbar.mainMode == tk2dTileMapToolbar.MainMode.Cut)
        {
            PickUpBrush(editorData.activeBrush, false);
            tk2dTileMapToolbar.workBrushFlipX = false;
            tk2dTileMapToolbar.workBrushFlipY = false;
        }
        if (tk2dTileMapToolbar.mainMode == tk2dTileMapToolbar.MainMode.Erase || tk2dTileMapToolbar.mainMode == tk2dTileMapToolbar.MainMode.Cut)
        {
            int x0 = Mathf.Min(cursorX, cursorX0);
            int x1 = Mathf.Max(cursorX, cursorX0);
            int y0 = Mathf.Min(cursorY, cursorY0);
            int y1 = Mathf.Max(cursorY, cursorY0);

            if (scratchpadGUI.workingHere)
            {
                scratchpadGUI.EraseTiles(x0, y0, x1, y1);
            }
            else
            {
                tileMap.DeleteSprites(editorData.layer, x0, y0, x1, y1);
            }
        }

        host.BuildIncremental();

        pencilDragActive = false;
    }