コード例 #1
0
ファイル: AnimationComponent.cs プロジェクト: tiomke/paradox
        /// <summary>
        /// Blends progressively a new animation.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="desiredWeight">The desired weight.</param>
        /// <param name="fadeTimeSpan">The fade time span.</param>
        /// <exception cref="ArgumentException">name</exception>
        public PlayingAnimation Blend(string name, float desiredWeight, TimeSpan fadeTimeSpan)
        {
            if (!Animations.ContainsKey(name))
            {
                throw new ArgumentException("name");
            }

            var playingAnimation = new PlayingAnimation(this, name)
            {
                CurrentTime = TimeSpan.Zero, Weight = 0.0f
            };

            PlayingAnimations.Add(playingAnimation);

            if (fadeTimeSpan > TimeSpan.Zero)
            {
                playingAnimation.WeightTarget  = desiredWeight;
                playingAnimation.RemainingTime = fadeTimeSpan;
            }
            else
            {
                playingAnimation.Weight = desiredWeight;
            }

            return(playingAnimation);
        }
コード例 #2
0
 /// <summary>
 /// Plays right away the animation with the specified name, instantly removing all other blended animations.
 /// </summary>
 /// <param name="name">The animation name.</param>
 public void Play(string name)
 {
     PlayingAnimations.Clear();
     PlayingAnimations.Add(new PlayingAnimation(this, name)
     {
         CurrentTime = TimeSpan.Zero, Weight = 1.0f
     });
 }
コード例 #3
0
ファイル: AnimationComponent.cs プロジェクト: tiomke/paradox
        /// <summary>
        /// Plays right away the animation with the specified name, instantly removing all other blended animations.
        /// </summary>
        /// <param name="name">The animation name.</param>
        public PlayingAnimation Play(string name)
        {
            PlayingAnimations.Clear();
            var playingAnimation = new PlayingAnimation(this, name)
            {
                CurrentTime = TimeSpan.Zero, Weight = 1.0f
            };

            PlayingAnimations.Add(playingAnimation);
            return(playingAnimation);
        }