/// <summary> /// Initializes a new instance of the <see cref="BoneAnimation"/> class. /// </summary> public BoneAnimation(Skeleton skeleton, IBoneAnimationController animationController) : this(skeleton) { if (animationController == null) { throw new ArgumentNullException("animationController"); } this.Controllers.Add(animationController); }
/// <summary> /// Creates a new instance of WeightedBoneAnimationController. /// </summary> internal WeightedBoneAnimationController(Skeleton skeleton, IBoneAnimationController controller) { if (controller == null) { throw new ArgumentNullException("controller"); } List <WeightedBoneAnimationControllerBone> bones = new List <WeightedBoneAnimationControllerBone>(skeleton.BoneTransforms.Length); for (int i = 0; i < skeleton.BoneTransforms.Length; ++i) { bones.Add(new WeightedBoneAnimationControllerBone()); } this.Skeleton = skeleton; this.Controller = controller; this.BlendWeight = 1; this.BoneWeights = new WeightedBoneAnimationControllerBoneCollection(this, bones); }
internal WeightedBoneAnimationController(Skeleton skeleton, IBoneAnimationController controller) { if (controller == null) { throw new ArgumentNullException("controller"); } if (skeleton == null) { throw new ArgumentNullException("skeleton"); } List <WeightedBoneAnimationControllerBone> bones = new List <WeightedBoneAnimationControllerBone>(skeleton.Bones.Count); for (int i = 0; i < skeleton.Bones.Count; i++) { bones.Add(new WeightedBoneAnimationControllerBone()); } Skeleton = skeleton; Controller = controller; BlendWeight = 1; BoneWeights = new WeightedBoneAnimationControllerBoneCollection(this, bones); }
private void SychronizeSpeed() { if (_isSychronized && _keyController != null) { TimeSpan duration = _keyController.Duration; for (int i = 0; i < _controllers.Count; i++) { IBoneAnimationController controller = _controllers[i].Controller; if (controller == _keyController) { continue; } ITimelineAnimation animation = controller as ITimelineAnimation; if (animation == null) { continue; } animation.Speed = (float)((double)animation.Duration.Ticks * _keyController.Speed / duration.Ticks); } } }