public WallManager(Texture2D wallTexture) { this.wallTexture = wallTexture; blocks = new WallBlock[startingNumberOfBlocks]; for (int i = 0; i < blocks.Length; i++) { blocks[i] = new WallBlock(wallTexture, createPositionVector(i)); wallHeight += 1; } }
public void removeBlock() { if (blocks.Length > 0) { WallBlock[] temp = new WallBlock[blocks.Length - 1]; for (int i = 0; i < temp.Length; i++) { temp[i] = blocks[i]; } wallHeight -= 1; blocks = temp; } }
public bool addBlock() { if (blocks.Length <= 9) { WallBlock[] temp = new WallBlock[blocks.Length + 1]; for (int i = 0; i < blocks.Length; i++) { temp[i] = blocks[i]; } temp[blocks.Length] = new WallBlock(wallTexture, createPositionVector(blocks.Length)); wallHeight += 1; blocks = temp; return true; } return false; }
public void Reset() { blocks = new WallBlock[startingNumberOfBlocks]; for (int i = 0; i < blocks.Length; i++) { blocks[i] = new WallBlock(wallTexture, createPositionVector(i)); wallHeight += 1; } }