예제 #1
0
        private IAnimation createLeftRightAnimation(IAnimation animation)
        {
            foreach (var frame in animation.Frames)
            {
                frame.Sprite.Pivot = new PointF(0.5f, 0f);
            }
            IAnimation clone = animation.Clone();

            clone.FlipHorizontally();
            return(clone);
        }
예제 #2
0
        /// <summary>
        /// Produces a tween instance
        /// NOTE: optimize cloning
        /// <see cref="http://stackoverflow.com/questions/129389/how-do-you-do-a-deep-copy-an-object-in-net-c-specifically"/>
        /// Using the "Nested MemberwiseClone" technique is an order of magnitude faster again (see my post under @Gravitas). – Gravitas Jan 1 at 23:29
        /// </summary>
        /// <returns></returns>
        public IAnimation Produce()
        {
            if (null == _bluePrint)
            {
                throw new Exception("Blueprint is null");
            }

            IAnimation clone = (IAnimation)_bluePrint.Clone();

            //Debug.Log("*** CLONED: " + clone);

#if DEBUG
            if (DebugMode)
            {
                Debug.Log(@"Blueprint cloned: " + clone);
            }
#endif
            // set default delay here, so it could be overriden
            clone.Delay    = Delay;
            clone.Duration = Duration;

            var t = clone as ITween;
            if (null != t)
            {
                t.Easer = _easer;
            }

            ConfigureInstance(clone);

#if DEBUG
            if (DebugMode)
            {
                Debug.Log("TweenFactory->Produce: " + clone);
            }
#endif
            //Debug.Log("Instance configured: " + clone);

            return(clone);
        }
예제 #3
0
		private IAnimation createLeftRightAnimation(IAnimation animation)
		{
			foreach (var frame in animation.Frames)
			{
				frame.Sprite.Anchor = new PointF (0.5f, 0f);
			}
			IAnimation clone = animation.Clone();
			clone.FlipHorizontally();
			return clone;
		}