Beispiel #1
0
        /* mock constructor */
        protected Field(int width, int height)
        {
            currentField = this;
            cells        = new FieldCellArray(width, height);

            timerManager = new TimerManager();
            players      = new PlayerList(timerManager, CVars.cg_maxPlayers.intValue);

            m_tempCellsList   = new LinkedList <FieldCell>();
            m_tempMovableList = new List <MovableCell>();

            movableCells = new LinkedList <MovableCell>();
        }
        /* mock constructor */
        protected Field(int width, int height)
        {
            currentField = this;
            cells = new FieldCellArray(width, height);

            timerManager = new TimerManager();
            players = new PlayerList(timerManager, CVars.cg_maxPlayers.intValue);

            m_tempCellsList = new LinkedList<FieldCell>();
            m_tempMovableList = new List<MovableCell>();

            movableCells = new LinkedList<MovableCell>();
        }
Beispiel #3
0
        private void SetupField(FieldData data, int brickDensity = -1)
        {
            int width  = data.GetWidth();
            int height = data.GetHeight();

            cells = new FieldCellArray(width, height);

            movableCells = new LinkedList <MovableCell>();

            for (int y = 0; y < height; ++y)
            {
                for (int x = 0; x < width; ++x)
                {
                    FieldBlocks block = data.Get(x, y);
                    switch (block)
                    {
                    case FieldBlocks.Blank:
                    {
                        break;
                    }

                    case FieldBlocks.Brick:
                    {
                        if (brickDensity == -1 || MathHelp.NextInt(100) <= brickDensity)
                        {
                            AddCell(new BrickCell(x, y));
                        }
                        break;
                    }

                    case FieldBlocks.Solid:
                    {
                        AddCell(new SolidCell(x, y));
                        break;
                    }

                    default:
                    {
                        Debug.Assert(false, "Unsupported cell type: " + block);
                        break;
                    }
                    }
                }
            }
        }
        private void SetupField(FieldData data, int brickDensity = -1)
        {
            int width = data.GetWidth();
            int height = data.GetHeight();

            cells = new FieldCellArray(width, height);

            movableCells = new LinkedList<MovableCell>();

            for (int y = 0; y < height; ++y)
            {
                for (int x = 0; x < width; ++x)
                {
                    FieldBlocks block = data.Get(x, y);
                    switch (block)
                    {
                        case FieldBlocks.Blank:
                        {
                            break;
                        }

                        case FieldBlocks.Brick:
                        {
                            if (brickDensity == -1 || MathHelp.NextInt(100) <= brickDensity)
                            {
                                AddCell(new BrickCell(x, y));
                            }
                            break;
                        }

                        case FieldBlocks.Solid:
                        {
                            AddCell(new SolidCell(x, y));
                            break;
                        }

                        default:
                        {
                            Debug.Assert(false, "Unsupported cell type: " + block);
                            break;
                        }
                    }
                }
            }
        }