예제 #1
0
        public override void Update(GameTime gameTime)
        {
            var scaleValue = Vector2.One * scaleRate;
            var alphaValue = alphaSpeed;

            if (option == FadeOption.Out)
            {
                scaleValue *= -1;
                alphaValue *= -1;
            }
            alpha += alphaValue;
            scale += scaleValue;
            if (scale.X < 0 || scale.Y < 0)
            {
                scale = Vector2.Zero;
            }
            if (scale.X > 2 || scale.Y > 2)
            {
                scale = Vector2.One * 2;
            }
            if (alpha < 0)
            {
                alpha = 0;
            }
            if (alpha > 1)
            {
                alpha = 1;
            }
            if (GameObjectManager.Instance.Find <Player>().First().MoveLock)
            {
                option = FadeOption.In;
            }
            base.Update(gameTime);
        }
예제 #2
0
        public static void Fade(Image fadeImage, FadeOption _fadeOption, Action _onCompleteFadeAction = null)
        {
            float fadeAmount = 0f;
            float fadeTime   = 0f;

            switch (_fadeOption)
            {
            case FadeOption.In:
                fadeAmount = 1f;
                fadeTime   = Config.TIME_FOR_FADE_IN;
                break;

            case FadeOption.Out:
                fadeTime = Config.TIME_FOR_FADE_OUT;
                break;
            }

            DOVirtual.Float(fadeImage.color.a, fadeAmount, fadeTime, (_value) =>
            {
                Color color     = fadeImage.color;
                color.a         = _value;
                fadeImage.color = color;
            }).OnComplete(() =>
            {
                _onCompleteFadeAction?.Invoke();
            });
        }
예제 #3
0
 public Fade(Vector2 position, FadeOption option)
     : base("fade", position, new Point(800, 600))
 {
     this.option = option;
     if (option == FadeOption.Out)
     {
         scale = Vector2.One * 2;
         alpha = 1f;
     }
     else
     {
         scale = Vector2.Zero;
         alpha = 0f;
     }
 }
예제 #4
0
 public static IDrawer FadeGroup(AnimBoolItemGetter fadeGetter, FadeOption options, params IDrawer[] groupDrawers)
 {
     return(new FadeGroupsDrawerInternal(fadeGetter, options, groupDrawers));
 }
예제 #5
0
 public FadeGroupsDrawerInternal(AnimBoolItemGetter getter, FadeOption options, params IDrawer[] groupDrawers)
 {
     m_GroupDrawers = groupDrawers;
     m_Getter       = getter;
     m_Options      = options;
 }
예제 #6
0
 public FadeOperation(FadeOption fadeOption, float duration)
 {
     this.fadeOption = fadeOption;
     this.delay      = 0;
     this.duration   = duration;
 }