Ejemplo n.º 1
0
 private void DrawCell(Context context, FieldCell cell)
 {
     if (cell.IsBrick())
     {
         DrawBrick(context, cell.AsBrick());
     }
     else if (cell.IsSolid())
     {
         DrawSolid(context, cell);
     }
     else if (cell.IsBomb())
     {
         DrawBomb(context, cell.AsBomb());
     }
     else if (cell.IsFlame())
     {
         DrawFlame(context, cell.AsFlame());
     }
     else if (cell.IsPowerup())
     {
         DrawPowerup(context, cell.AsPowerup());
     }
     else if (cell.IsPlayer())
     {
         DrawPlayer(context, cell.AsPlayer());
     }
 }
Ejemplo n.º 2
0
        /* Returns true if can be spread more */
        private bool SetFlame(Bomb bomb, int cx, int cy)
        {
            if (!IsInsideField(cx, cy))
            {
                return(false);
            }

            FieldCellSlot slot = GetSlot(cx, cy);

            FieldCell staticCell = slot.staticCell;

            if (staticCell != null)
            {
                if (staticCell.IsSolid())
                {
                    return(false);
                }

                if (staticCell.IsBrick())
                {
                    BrickCell brick = staticCell.AsBrick();
                    if (!brick.destroyed)
                    {
                        brick.Destroy();
                    }

                    return(false);
                }

                if (staticCell.IsPowerup())
                {
                    staticCell.AsPowerup().RemoveFromField();
                    return(false);
                }
            }

            if (slot.MovableCount() > 0)
            {
                LinkedList <FieldCell> tempList = new LinkedList <FieldCell>();
                slot.GetCells(tempList);

                foreach (FieldCell cell in tempList)
                {
                    if (cell.IsBomb())
                    {
                        cell.AsBomb().Blow();
                    }
                    else if (cell.IsPlayer())
                    {
                        KillPlayer(cell.AsPlayer());
                    }
                }
            }

            SetFlame(bomb.player, cx, cy);
            return(true);
        }
 private void DrawCell(Context context, FieldCell cell)
 {
     if (cell.IsBrick())
     {
         DrawBrick(context, cell.AsBrick());
     }
     else if (cell.IsSolid())
     {
         DrawSolid(context, cell);
     }
     else if (cell.IsBomb())
     {
         DrawBomb(context, cell.AsBomb());
     }
     else if (cell.IsFlame())
     {
         DrawFlame(context, cell.AsFlame());
     }
     else if (cell.IsPowerup())
     {
         DrawPowerup(context, cell.AsPowerup());
     }
     else if (cell.IsPlayer())
     {
         DrawPlayer(context, cell.AsPlayer());
     }
 }