Exemple #1
0
        public virtual void Update(FrameEventArgs e)
        {
            if (translation != null)
            {
                Vector2 newLocation;
                translation.time += 1000;
                Vector2.Lerp(ref location, ref translation.destination, (float)translation.time / translation.translationTime * (float)e.Time, out newLocation);
                SetBoundsNoScaling(newLocation.X, newLocation.Y, null, null);

                if ((newLocation - translation.destination).Length <= .001f)
                {
                    translation.time = 0;
                    SetBoundsNoScaling(translation.Destination.X, translation.Destination.Y, null, null);

                    // call events

                    translation = null;
                }
            }
        }
Exemple #2
0
        public virtual void Update(FrameEventArgs e)
        {
            if (translation != null)
            {
                Vector2 newLocation;
                translation.time += 1000;
                Vector2.Lerp(ref location, ref translation.destination, (float)translation.time / translation.translationTime*(float)e.Time, out newLocation);
                SetBoundsNoScaling(newLocation.X, newLocation.Y, null, null);

                if ((newLocation - translation.destination).Length <= .001f)
                {
                    translation.time = 0;
                    SetBoundsNoScaling(translation.Destination.X, translation.Destination.Y, null, null);

                    // call events

                    translation = null;
                }
            }
        }