コード例 #1
0
        public LinkedList <T> GetChunkAt(int x, int y)
        {
            ChunkAddress addr = new ChunkAddress()
            {
                X = x / ChunkSize, Y = y / ChunkSize
            };

            return(Chunks.ContainsKey(addr) ? Chunks[addr] : null);
        }
コード例 #2
0
        public void InsertAt(T item, int x, int y)
        {
            ChunkAddress addr = new ChunkAddress()
            {
                X = x / ChunkSize, Y = y / ChunkSize
            };

            if (!Chunks.ContainsKey(addr))
            {
                Chunks.Add(addr, new LinkedList <T>());
            }

            Chunks[addr].AddLast(item);
        }