升级obi

This commit is contained in:
2026-01-22 22:08:21 +08:00
parent 120b8cda26
commit 20f14322bc
1067 changed files with 149894 additions and 29583 deletions

View File

@@ -1,43 +0,0 @@
#if (OBI_ONI_SUPPORTED)
using UnityEngine;
using System;
using System.Collections;
namespace Obi
{
public class OniBackend : IObiBackend
{
private OniColliderWorld colliderGrid;
#region Solver
public ISolverImpl CreateSolver(ObiSolver solver, int capacity)
{
GetOrCreateColliderWorld();
colliderGrid.IncreaseReferenceCount();
return new OniSolverImpl(Oni.CreateSolver(capacity));
}
public void DestroySolver(ISolverImpl solver)
{
if (solver != null)
{
if (colliderGrid != null)
colliderGrid.DecreaseReferenceCount();
solver.Destroy();
}
}
// Single type of collision world. Each solver implementation should manage the data as it can.
private void GetOrCreateColliderWorld()
{
colliderGrid = GameObject.FindObjectOfType<OniColliderWorld>();
if (colliderGrid == null)
{
var world = new GameObject("OniCollisionWorld", typeof(OniColliderWorld));
colliderGrid = world.GetComponent<OniColliderWorld>();
}
}
#endregion
}
}
#endif