Ejemplo n.º 1
0
 /// <summary>
 /// Places a block in the grid. Also executes the CheckRows and NewBlock methods in the parent object.
 /// </summary>
 protected virtual void PlaceBlock()
 {
     for (int i = 0; i < BlockGrid.GetLength(0); i++)
     {
         for (int f = 0; f < BlockGrid.GetLength(1); f++)
         {
             if (BlockGrid[i, f])
             {
                 parent.grid[(int)BlockPosition.X + i, (int)BlockPosition.Y + f] = color;
             }
         }
     }
     GameWorld.BlockPlaced.Play();
     parent.CheckRows();
     if (BlockPosition == new Vector2(6, 0))
     {
         parent.IsDead = true;
     }
     parent.NewBlock();
 }