示例#1
0
        /// <summary>
        /// Destroys given Affector
        /// </summary>
        /// <param name="affector"></param>
        public void DestroyAffector(Affector affector)
        {
            if (!_affectors.Contains(affector))
            {
                throw new InvalidRequestException("Given affector not found!");
            }

            _affectors.Remove(affector);
            // TODO: CEGUI_DELETE_AO affector;
        }
示例#2
0
        /// <summary>
        /// Creates a new Affector
        /// </summary>
        /// <returns></returns>
        /// <seealso cref="Affector"/>
        public Affector CreateAffector()
        {
            // no checking needed!

            var ret = new Affector(this);

            _affectors.Add(ret);

            return(ret);
        }
        public AnimationKeyFrameHandler(XMLAttributes attributes, Affector affector)
        {
            //throw new NotImplementedException();
            var progressionStr = attributes.GetValueAsString(ProgressionAttribute);

            var logEvent = new StringBuilder("\t\tAdding KeyFrame at position: " +
                                             attributes.GetValueAsString(PositionAttribute) +
                                             "  Value: " +
                                             attributes.GetValueAsString(ValueAttribute));

            if (!string.IsNullOrEmpty(progressionStr))
            {
                logEvent.Append("  Progression: " + attributes.GetValueAsString(ProgressionAttribute, ProgressionLinear));
            }

            Logger.LogInsane(logEvent.ToString());

            KeyFrame.Progression progression;
            if (progressionStr == ProgressionDiscrete)
            {
                progression = KeyFrame.Progression.Discrete;
            }
            else if (progressionStr == ProgressionQuadraticAccelerating)
            {
                progression = KeyFrame.Progression.QuadraticAccelerating;
            }
            else if (progressionStr == ProgressionQuadraticDecelerating)
            {
                progression = KeyFrame.Progression.QuadraticDecelerating;
            }
            else
            {
                progression = KeyFrame.Progression.Linear;
            }

            affector.CreateKeyFrame(
                attributes.GetValueAsFloat(PositionAttribute),
                attributes.GetValueAsString(ValueAttribute),
                progression,
                attributes.GetValueAsString(SourcePropertyAttribute));

            if (affector.GetNumKeyFrames() == 1 && !string.IsNullOrEmpty(progressionStr))
            {
                System.GetSingleton().Logger
                .LogEvent("WARNING: progression type specified for first keyframe in animation will be ignored.");
            }

            d_completed = true;
        }
示例#4
0
 /// <summary>
 /// internal constructor, please use Affector::createKeyFrame
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="position"></param>
 internal KeyFrame(Affector parent, float position)
 {
     d_parent      = parent;
     d_position    = position;
     d_progression = Progression.Linear;
 }