public void AddBlock(int row, int col, Block.BlockTypes type) { Vector3 position = getWorldPositionFromArray(row, col); GameObject newBlock = null; switch (type) { case Block.BlockTypes.Red: newBlock = Instantiate(Resources.Load("RedBlock"), position, Quaternion.identity) as GameObject; break; case Block.BlockTypes.Green: newBlock = Instantiate(Resources.Load("GreenBlock"), position, Quaternion.identity) as GameObject; break; case Block.BlockTypes.Blue: newBlock = Instantiate(Resources.Load("BlueBlock"), position, Quaternion.identity) as GameObject; break; } if (newBlock != null) { Block theBlock = newBlock.GetComponent <Block>(); theBlock.Row = row; theBlock.Col = col; occupancyList[row, col] = theBlock; } }
public void AddRow() { for (int i = 0; i < PLAY_AREA_WIDTH; ++i) { Block.BlockTypes type = (Block.BlockTypes)rng.Next(0, Block.Num_Colors); AddBlock(0, i, type); } }
public static bool CheckForDupes(Block.BlockTypes block) { for (int i = 0; i < Items.Count; i++) { if (Items[i].BlockType == block) { return(true); } } return(false); }