/// <summary> /// Initializes a new instance of the <see cref="AnimationState" /> class. /// </summary> /// <param name="data">The data.</param> /// <exception cref="System.ArgumentNullException">data cannot be null.</exception> public AnimationState(AnimationStateData data) { if (data == null) { throw new ArgumentNullException("data cannot be null."); } this.Data = data; }
/// <summary> /// Performs further custom initialization for this instance. /// </summary> /// <remarks> /// By default this method does nothing. /// </remarks> protected override void Initialize() { base.Initialize(); SkeletonJson json = new SkeletonJson(this.SkeletalData.Atlas); this.Skeleton = new Skeleton(json.ReadSkeletonData(this.animationPath)); if (string.IsNullOrEmpty(this.currentSkin)) { this.Skeleton.SetSkin(this.Skeleton.Data.DefaultSkin); } else { this.Skeleton.SetSkin(this.currentSkin); this.Skeleton.SetSlotsToBindPose(); } AnimationStateData stateData = new AnimationStateData(this.Skeleton.Data); this.state = new AnimationState(stateData); this.state.EndAnimation += this.OnEndAnimation; }