/// /// Create new endpoints for the current line /// or create a new line. /// internal void LineCreateVertex() { Debug.Assert(cursors.Count > 0); if (mode != Mode.Line) { DeselectAll(); PinCursor(); line_origin = cursors.Count - 1; mode = Mode.Line; return; } cursors.Sync(); // To create a new vertex we need to swap the last cursor with // the current origin, which will be earlier in the cursors list // than the cursors created for the current line. var start = cursors[line_origin]; cursors[line_origin] = cursors[cursors.Count - 1]; cursors[cursors.Count - 1] = new Cursor() { position = start.position, pinned = true }; // The new origin, point_a is now the previous origin // point_a is at Count - 2 (pinned) // point_b is at Count - 1 (line_origin) cursors.Add(start.position); line_origin = cursors.Count - 1; }
internal Buffer(Chunk chunk, GameObject[] palette, Camera view, Config config) { this.view = view; this.chunk = chunk; this.palette = palette; this.config = config; undo = new Undo(); cursors = new Cursors(chunk.bounds, chunk.cell_scale); deletion_pool = new List <GameObject>(); selection = new GameObject[16]; prefab_parents = new GameObject[palette.Length]; saved_view = new View() { position = view.transform.position, orthographic_size = view.orthographicSize }; cursors.Add((Vector2)view.transform.position - Vector2.one); }