コード例 #1
0
    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);
        }));
    }
コード例 #2
0
    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);
        }));
    }