Exemplo 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());
     }
 }
Exemplo 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);
        }
Exemplo n.º 3
0
        protected override bool HandleStaticCollision(FieldCell other)
        {
            if (other.IsFlame())
            {
                return HandleCollision(other.AsFlame());
            }

            if (other.IsPowerup())
            {
                return HandleCollision(other.AsPowerup());
            }

            return HandleObstacleCollistion(other);
        }
 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());
     }
 }
Exemplo n.º 5
0
 public PowerupCell GetPowerup()
 {
     return(staticCell != null?staticCell.AsPowerup() : null);
 }