Ejemplo n.º 1
0
        public MapChunk GetMapChunk(uint x, uint y)
        {
            uint     cellIndex = (y % c_CellsInMemorySpan) * c_CellsInMemorySpan + (x % c_CellsInMemorySpan);
            MapChunk cell      = m_Chunks[cellIndex];

            if (cell == null)
            {
                return(null);
            }
            if (cell.ChunkX != x || cell.ChunkY != y)
            {
                return(null);
            }
            return(cell);
        }
Ejemplo n.º 2
0
        public MapTile GetMapTile(uint x, uint y)
        {
            uint cellX = (uint)x / 8, cellY = (uint)y / 8;
            uint cellIndex = (cellY % c_CellsInMemorySpan) * c_CellsInMemorySpan + (cellX % c_CellsInMemorySpan);

            MapChunk cell = m_Chunks[cellIndex];

            if (cell == null)
            {
                return(null);
            }
            if (cell.ChunkX != cellX || cell.ChunkY != cellY)
            {
                return(null);
            }
            return(cell.Tiles[(y % 8) * 8 + (x % 8)]);
        }