public void End(Point tile) { if (region == null) return; EditorExtensionNode node = form.SelectedSquareType(); if (node != null) { foreach (Point p in Line(start, tile)) { Vector3 loc = new Vector3(p.X + form.Map.View.x, p.Y + form.Map.View.y, form.Map.View.z); AbstractSquare sq = (AbstractSquare)node.CreateInstance(); change.AddOperation(form.Map.GetSafeSquare(loc), sq, loc); form.Map.SetSquare(loc, sq); } } if (change.Count > 0) form.UndoRedo.AddChange(change); change = null; region.InvalidateTiles(); region.Dispose(); region = null; form.Map.ViewFrom(form.Map.View, true); }
public void Start(Point tile) { region = new EmptyControl(form.Map.Size, new Point(0,0)); change = new SquareChange(form.Map); form.Map.AddRegion(region); start = oldend = tile; }