using System;
using Unity.Collections;
using VRM.FastSpringBones.Blittables;
namespace VRM.FastSpringBones.NativeWrappers
{
///
/// BlittableColliderGroupのライフサイクルを管理するWrapper
///
public sealed unsafe class NativeColliderGroup : IDisposable
{
private readonly NativePointer _nativePointer;
private NativeArray Colliders { get; }
public BlittableColliderGroup* GetUnsafePtr() => _nativePointer.GetUnsafePtr();
public NativeColliderGroup(BlittableCollider[] colliders, NativeTransform nativeTransform)
{
Colliders = new NativeArray(colliders, Allocator.Persistent);
_nativePointer = new NativePointer(new BlittableColliderGroup(Colliders, nativeTransform.GetUnsafePtr()));
}
public void Dispose()
{
if (Colliders.IsCreated) Colliders.Dispose();
_nativePointer.Dispose();
}
}
}