public AnimationDefinitionHandler(XMLAttributes attributes, string namePrefix)
        {
            _anim = null;

            var animName = namePrefix + attributes.GetValueAsString(NameAttribute);

            Logger.LogInsane(
                "Defining animation named: " +
                animName +
                "  Duration: " +
                attributes.GetValueAsString(DurationAttribute) +
                "  Replay mode: " +
                attributes.GetValueAsString(ReplayModeAttribute) +
                "  Auto start: " +
                attributes.GetValueAsString(AutoStartAttribute, "false"));

            _anim = AnimationManager.GetSingleton().CreateAnimation(animName);

            _anim.SetDuration(attributes.GetValueAsFloat(DurationAttribute));

            var replayMode = attributes.GetValueAsString(ReplayModeAttribute, ReplayModeLoop);

            if (replayMode == ReplayModeOnce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Once);
            }
            else if (replayMode == ReplayModeBounce)
            {
                _anim.SetReplayMode(Animation.ReplayMode.Bounce);
            }
            else
            {
                _anim.SetReplayMode(Animation.ReplayMode.Loop);
            }

            _anim.SetAutoStart(attributes.GetValueAsBool(AutoStartAttribute));
        }
예제 #2
0
 /// <summary>
 /// call this to ensure system-level time based updates occur.
 /// </summary>
 /// <param name="timeElapsed"></param>
 /// <returns></returns>
 public bool InjectTimePulse(float timeElapsed)
 {
     AnimationManager.GetSingleton().AutoStepInstances(timeElapsed);
     return(true);
 }
예제 #3
0
 /// <summary>
 /// Sets interpolator of this Affector
 /// <para>
 /// Interpolator has to be set for the Affector to work!
 /// </para>
 /// </summary>
 /// <param name="name"></param>
 public void SetInterpolator(string name)
 {
     _interpolator = AnimationManager.GetSingleton().GetInterpolator(name);
 }