Exemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="xBlocks">Number of x blocks to represent the world</param>
        /// <param name="yBlocks">Number of y blocks to represent the world</param>
        /// <param name="bounds">World boundries</param>
        public WorldGrid(int xBlocks, int yBlocks, WorldBounds bounds)
        {
            _numXBlocks   = xBlocks;
            _numYBlocks   = yBlocks;
            _xBlockWidth  = (float)bounds.XBound / (float)xBlocks;
            _yBlockHeight = (float)bounds.YBound / (float)yBlocks;

            _buckets = new GridBucket[_numXBlocks, _numYBlocks];

            // Initiliase the buckets
            for (int x = 0; x < _numXBlocks; x++)
            {
                for (int y = 0; y < _numYBlocks; y++)
                {
                    GridBucket bucket = new GridBucket();
                    _buckets[x, y] = bucket;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="xBlocks">Number of x blocks to represent the world</param>
        /// <param name="yBlocks">Number of y blocks to represent the world</param>
        /// <param name="bounds">World boundries</param>
        public WorldGrid(int xBlocks, int yBlocks, WorldBounds bounds)
        {
            _numXBlocks = xBlocks;
            _numYBlocks = yBlocks;
            _xBlockWidth = (float)bounds.XBound / (float)xBlocks;
            _yBlockHeight = (float)bounds.YBound / (float)yBlocks;

            _buckets = new GridBucket[_numXBlocks, _numYBlocks];

            // Initiliase the buckets
            for (int x = 0; x < _numXBlocks; x++)
            {
                for (int y = 0; y < _numYBlocks; y++)
                {
                    GridBucket bucket = new GridBucket();
                    _buckets[x, y] = bucket;
                }
            }
        }