本文整理汇总了C#中PhysX.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# PhysX.Dispose方法的具体用法?C# PhysX.Dispose怎么用?C# PhysX.Dispose使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PhysX
的用法示例。
在下文中一共展示了PhysX.Dispose方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeleteActor
private void DeleteActor(PhysX.RigidActor oldActor, PhysicsShape oldShape, bool wasPhysical, DeleteActorFlags flags)
{
if (oldActor != null)
{
if (_touchCounts.IsValueCreated)
{
SendCollisionEndToContactedObjects();
_touchCounts.Value.Clear();
}
_scene.ForEachCharacter((PhysxCharacter character) =>
{
character.InvalidateControllerCacheIfContacting(this);
}
);
_scene.SceneImpl.RemoveActor(oldActor);
oldActor.Dispose();
if ((flags & DeleteActorFlags.DestroyPrimaryMaterial) != 0)
{
_properties.PhysxMaterial.CheckedDispose();
}
if ((flags & DeleteActorFlags.DestroyChildMaterials) != 0)
{
//also dispose child prim materials
foreach (PhysxPrim prim in _childShapes.Keys)
{
prim._properties.PhysxMaterial.CheckedDispose();
}
}
//unref our old shape
if (oldShape != null)
{
_scene.MeshingStageImpl.UnrefShape(oldShape, wasPhysical);
if ((flags & DeleteActorFlags.UnrefChildShapes) != 0)
{
//unref child shapes
foreach (RelatedShapes childShapes in _childShapes.Values)
{
_scene.MeshingStageImpl.UnrefShape(childShapes.ChildShape, wasPhysical);
}
}
}
//everyone watching us for delete should be informed
Action<PhysxPrim> onDel = this.OnDeleted;
if (onDel != null)
{
onDel(this);
foreach (Action<PhysxPrim> act in onDel.GetInvocationList())
{
onDel -= act;
}
}
if (_primsBeingWatchedForDeletes.IsValueCreated)
{
foreach (var prim in _primsBeingWatchedForDeletes.Value)
{
prim.OnDeleted -= new Action<PhysxPrim>(other_OnDeleted);
}
_primsBeingWatchedForDeletes = new Lazy<List<PhysxPrim>>();
}
//no matter if we're unreffing or not, the actual child shape list is now invalid becase
//these shapes were part of our old physx actor
_childShapes.Clear();
_shapeToPrimIndex.Clear();
_primaryShapes.Clear();
}
}