Beispiel #1
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);
        }
Beispiel #2
0
        public void UpdateSlot(float delta, FieldCellSlot slot)
        {
            slot.GetCells(m_tempCellsList);

            if (m_tempCellsList.Count > 0)
            {
                foreach (FieldCell cell in m_tempCellsList)
                {
                    cell.Update(delta);
                }
                m_tempCellsList.Clear();
            }
        }
        public void UpdateSlot(float delta, FieldCellSlot slot)
        {
            slot.GetCells(m_tempCellsList);

            if (m_tempCellsList.Count > 0)
            {
                foreach (FieldCell cell in m_tempCellsList)
                {
                    cell.Update(delta);
                }
                m_tempCellsList.Clear();
            }
        }