internal Entity(IntPtr entity) : base(entity) { if (hasSkeleton()) { skeleton = new SkeletonInstance(Entity_getSkeleton(ogreObject)); } }
/// <summary> /// Save the skeleton to this description. /// </summary> /// <param name="skeleton">The skeleton to save.</param> public void saveSkeleton(SkeletonInstance skeleton) { if (skeleton != null) { for (ushort i = 0; i < skeleton.getNumBones(); i++) { bones.Add(new BoneInfo(skeleton.getBone(i))); } } }
/// <summary> /// Load a skeleton back from this description. /// </summary> /// <param name="skeleton"></param> public void initialzeSkeleton(SkeletonInstance skeleton) { if (skeleton != null) { if (skeleton.getNumBones() == bones.Count) { for (ushort i = 0; i < skeleton.getNumBones(); i++) { bones[i].restoreBone(skeleton.getBone(i)); } } else { Log.Default.sendMessage("Mismatched number of bones in loaded skeleton, state not restored.", LogLevel.Error, "ObjectManagement"); } } }