private void fillStroke(CanvasStroke <bool> stroke) { if (!Collision.InBounds(ZoneManager.Instance.CurrentGround.TexWidth, ZoneManager.Instance.CurrentGround.TexHeight, stroke.CoveredRect.Start)) { return; } uint tile = ZoneManager.Instance.CurrentGround.GetObstacle(stroke.CoveredRect.Start.X, stroke.CoveredRect.Start.Y); bool blocked = stroke.GetBrush(stroke.CoveredRect.Start); Dictionary <Loc, uint> brush = new Dictionary <Loc, uint>(); Grid.FloodFill(new Rect(0, 0, ZoneManager.Instance.CurrentGround.TexWidth, ZoneManager.Instance.CurrentGround.TexHeight), (Loc testLoc) => { if (brush.ContainsKey(testLoc)) { return(true); } return(tile != ZoneManager.Instance.CurrentGround.GetObstacle(testLoc.X, testLoc.Y)); }, (Loc testLoc) => { return(true); }, (Loc testLoc) => { brush[testLoc] = blocked ? 1u : 0u; }, stroke.CoveredRect.Start); DiagManager.Instance.DevEditor.GroundEditor.Edits.Apply(new DrawBlockUndo(brush)); }
private void fillStroke(CanvasStroke <EffectTile> stroke) { if (!Collision.InBounds(ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height, stroke.CoveredRect.Start)) { return; } EffectTile tile = ZoneManager.Instance.CurrentMap.Tiles[stroke.CoveredRect.Start.X][stroke.CoveredRect.Start.Y].Effect; Dictionary <Loc, EffectTile> brush = new Dictionary <Loc, EffectTile>(); EffectTile brushTile = stroke.GetBrush(stroke.CoveredRect.Start); RogueElements.Grid.FloodFill(new Rect(0, 0, ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height), (Loc testLoc) => { if (brush.ContainsKey(testLoc)) { return(true); } return(tile.ID != ZoneManager.Instance.CurrentMap.Tiles[testLoc.X][testLoc.Y].Effect.ID); }, (Loc testLoc) => { return(true); }, (Loc testLoc) => { brush[testLoc] = new EffectTile(brushTile, testLoc); }, stroke.CoveredRect.Start); DiagManager.Instance.DevEditor.MapEditor.Edits.Apply(new DrawTileUndo(brush)); }
private void paintStroke(CanvasStroke <bool> stroke) { Dictionary <Loc, uint> brush = new Dictionary <Loc, uint>(); foreach (Loc loc in stroke.GetLocs()) { if (!Collision.InBounds(ZoneManager.Instance.CurrentGround.TexWidth, ZoneManager.Instance.CurrentGround.TexHeight, loc)) { continue; } brush[loc] = stroke.GetBrush(loc) ? 1u : 0u; } DiagManager.Instance.DevEditor.GroundEditor.Edits.Apply(new DrawBlockUndo(brush)); }
private void paintStroke(CanvasStroke <EffectTile> stroke) { Dictionary <Loc, EffectTile> brush = new Dictionary <Loc, EffectTile>(); foreach (Loc loc in stroke.GetLocs()) { if (!Collision.InBounds(ZoneManager.Instance.CurrentMap.Width, ZoneManager.Instance.CurrentMap.Height, loc)) { continue; } brush[loc] = new EffectTile(stroke.GetBrush(loc), loc); } DiagManager.Instance.DevEditor.MapEditor.Edits.Apply(new DrawTileUndo(brush)); }