Ejemplo n.º 1
0
            public void Init()
            {
                m_FreeBits = ~0ul;

                int allocSize = sizeof(StateAllocLevel1) * 64;
                var l1        = m_Level1 = (StateAllocLevel1 *)Memory.Unmanaged.Allocate(allocSize, 16, Allocator.Persistent);

                UnsafeUtility.MemClear(l1, allocSize);

                for (int i = 0; i < 64; ++i)
                {
                    l1[i].FreeBits = ~0ul;
                }
            }
Ejemplo n.º 2
0
            public void Dispose()
            {
                var l1 = m_Level1;

                for (int i = 0; i < 64; ++i)
                {
                    if (l1[i].States != null)
                    {
                        Memory.Unmanaged.Free(l1[i].States, Allocator.Persistent);
                    }
                }

                Memory.Unmanaged.Free(l1, Allocator.Persistent);
                m_Level1 = null;

                this = default;
            }
Ejemplo n.º 3
0
            public void Dispose()
            {
                var l1 = m_Level1;

                for (int i = 0; i < 64; ++i)
                {
                    if (l1[i].States != null)
                    {
                        UnsafeUtility.Free(l1[i].States, Allocator.Persistent);
                    }
                }

                UnsafeUtility.Free(l1, Allocator.Persistent);
                m_Level1 = null;

                this = default;
            }