void stopAddingToBlock() { currentBlock = null; }
void addTargetBlock(object o) { // Copy block to the target grid and add a new BlockType for it so that the target BlockType is unique for hashing purposes object[] args = (object[])o; int cellX = (int)args[0]; int cellY = (int)args[1]; int blockID = (int)args[2]; clearTarget(); // Create another BlockType clone of the target block SlidingBlockType targetBlockType = new SlidingBlockType(Blocks[blockID].BlockType, blockPalette.Count); // Add it to the palette blockPalette.Add(targetBlockType); // Update the BlockType of the target block on the main grid to this new BlockType Blocks[blockID].BlockType = targetBlockType; // Copy the block and add it to the target grid SlidingBlock block = new SlidingBlock(cellX, cellY, targetBlockType, blockID); TargetBlocks.Add(block); }
void addNewBlock(object o) { // Clear the target block and start the creation of a new block on the main grid object[] args = (object[])o; // int cellX, int cellY int cellX = (int)args[0]; int cellY = (int)args[1]; clearTarget(); if (!occupied[cellX, cellY]) { currentBlock = new SlidingBlock(cellX, cellY,blockPalette[0], Blocks.Count); // Create 1x1 block, BlockType 0, blockID is the index into Blocks currentType = new SlidingBlockType(blockPalette[0]); Blocks.Add(currentBlock); occupied[cellX, cellY] = true; } }