public void StopSharingSkeletonInstance()
{
if ( this.sharedSkeletonInstances == null )
{
throw new AxiomException( "This entity is not sharing it's skeletoninstance." );
}
// Are we the last to stop sharing?
if ( this.sharedSkeletonInstances.Count == 1 )
{
this.sharedSkeletonInstances = null;
}
else
{
this.skeletonInstance = new SkeletonInstance( this.mesh.Skeleton );
this.skeletonInstance.Load();
this.animationState = new AnimationStateSet();
this.mesh.InitAnimationState( this.animationState );
this.frameBonesLastUpdated = new ulong[ ulong.MaxValue ];
this.numBoneMatrices = this.skeletonInstance.BoneCount;
this.boneMatrices = new Matrix4[ this.numBoneMatrices ];
this.sharedSkeletonInstances.Remove( this );
if ( this.sharedSkeletonInstances.Count == 1 )
{
this.sharedSkeletonInstances[ 0 ].StopSharingSkeletonInstance();
}
this.sharedSkeletonInstances = null;
}
}