Ejemplo n.º 1
0
        /// <summary>
        /// 开始呼吸效果.
        /// </summary>
        /// <returns>The breathe effect.</returns>
        /// <param name="target">目标.</param>
        /// <param name="scale1">Scale1.</param>
        /// <param name="scale2">Scale2.</param>
        /// <param name="duration">一呼或者一吸的持续时间(单位:秒数),默认为0.9秒.</param>
        public static MTFiniteTimeAction CreateBreatheEffect(GameObject target, float scale1, float scale2, float duration = 0.9f)
        {
            Vector3 scale = target.transform.localScale;

            var sx = scale.x;
            var sy = scale.y;

            var sx1 = scale1 * sx;
            var sx2 = scale2 * sx;
            var sy1 = scale1 * sy;
            var sy2 = scale2 * sy;

            var act1 = new MTEaseIn(new MTScaleTo(duration, sx1, sy2, scale.z), 1f);
            var act2 = new MTEaseIn(new MTScaleTo(duration, sx2, sy1, scale.z), 1f);

            var sequence = new MTSequence(act1, act2);
            var repeat   = new MTRepeatForever(sequence);

            return(repeat);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 创建一个果冻效果的Action.(非弹窗)
        /// </summary>
        /// <param name="target">目标对象.</param>
        /// <param name="delay">延迟秒数.</param>
        public static MTFiniteTimeAction CreateJellyAction(GameObject target, float delay = 0.0f, float timeScale = 1.0f, MTFiniteTimeAction endCall = null)
        {
            //以下效果参考了Flash JollyJam项目中EffectUtil.createJellyPopAction
            Vector3 scale = target.transform.localScale;

            var act1 = new MTEaseIn(new MTScaleTo(0.2f * timeScale, 1.03f * scale.x, 1f * scale.y, 1f), 1f);
            var act2 = new MTEaseIn(new MTScaleTo(0.0833f * timeScale, 0.97f * scale.x, 0.87f * scale.y, 1f), 1f);
            var act3 = new MTEaseIn(new MTScaleTo(0.0833f * timeScale, 1.0f * scale.x, 1.03f * scale.y, 1f), 1f);
            var act4 = new MTEaseIn(new MTScaleTo(0.125f * timeScale, 0.97f * scale.x, 0.97f * scale.y, 1f), 1f);
            var act5 = new MTEaseIn(new MTScaleTo(0.167f * timeScale, 1.0f * scale.x, 1.0f * scale.y, 1f), 1f);

            if (endCall == null)
            {
                return(new MTSequence(new MTDelayTime(delay), act1, act2, act3, act4, act5));
            }
            else
            {
                return(new MTSequence(new MTDelayTime(delay), act1, act2, act3, act4, act5, endCall));
            }
        }