Esempio n. 1
0
        private void addTransform(ITransform <T> transform)
        {
            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(derivedThis);
                return;
            }

            //we have no duration and do not need to be delayed, so we can just apply ourselves and be gone.
            bool canApplyInstant = transform.Duration == 0 && TransformDelay == 0;

            //we should also immediately apply any transforms that have already started to avoid potentially applying them one frame too late.
            if (canApplyInstant || transform.StartTime < Time.Current)
            {
                transform.UpdateTime(Time);
                transform.Apply(derivedThis);
                if (canApplyInstant)
                {
                    return;
                }
            }

            Transforms.Add(transform);
        }
Esempio n. 2
0
        private void addTransform(ITransform <T> transform)
        {
            if (transform == null)
            {
                throw new ArgumentNullException(nameof(transform));
            }

            if (Clock == null)
            {
                transform.UpdateTime(new FrameTimeInfo {
                    Current = transform.EndTime
                });
                transform.Apply(derivedThis);
                return;
            }

            Transforms.Add(transform);

            // If our newly added transform could have an immediate effect, then let's
            // make this effect happen immediately.
            if (transform.StartTime < Time.Current || transform.EndTime <= Time.Current)
            {
                updateTransforms();
            }
        }
Esempio n. 3
0
 private void transforms_OnRemoved(ITransform t)
 {
     t.Apply(this); //make sure we apply one last time.
 }