public void RemoveBlock(Vector3 position) { EditLayer layer = this.CurrentLayer; Block block = layer.GetBlock(position); if (block == null) { return; } this.AddCommand(new Command( () => { layer.RemoveBlock(block); }, () => { layer.AddBlock(block); })); }
public void AddBlock(Vector3 position, BlockDirection direction) { EditLayer layer = this.CurrentLayer; BlockShape shape = BlockShape.Find(this.toolBlock); if (shape == null) { return; } Block block = new Block(position, direction, shape); if (block == null) { return; } this.AddCommand(new Command( () => { layer.AddBlock(block); }, () => { layer.RemoveBlock(block); })); }