Beispiel #1
0
 /// <summary> Creates a Translation and Frame Animation, with the Translation being updated before the Frame. Note that each animation can be updated separately if needed. </summary>
 public Frame2DTranslationAnimation(TranslationAnimation translation, Frame2DAnimation frame)
 {
     Frame       = frame;
     Translation = translation;
     updateOrder = new BaseAnimation[] { Translation, Frame };
 }
Beispiel #2
0
 public Frame2DTranslationAnimation(Frame2DAnimation frame, TranslationAnimation translation)
 {
     Frame       = frame;
     Translation = translation;
     updateOrder = new BaseAnimation[] { Frame, Translation };
 }
 /// <summary> Creates a Translation and Frame Animation, with the Translation being updated before the Frame. Note that each animation can be updated separately if needed. </summary>
 public Frame2DTranslationAnimation(TranslationAnimation translation, Frame2DAnimation frame)
 {
     Frame = frame;
     Translation = translation;
     updateOrder = new BaseAnimation[] { Translation, Frame };
 }
 public Frame2DTranslationAnimation(Frame2DAnimation frame, TranslationAnimation translation)
 {
     Frame = frame;
     Translation = translation;
     updateOrder = new BaseAnimation[] { Frame, Translation };
 }
Beispiel #5
0
        private void SelectUp(GameTime gameTime)
        {
            var newMenuItem = (MenuConstants.MenuOption)Math.Max((int)this.selectedMenuOption - 1, 0);

            // If the menu isn't going to change, then do nothing.
            if (newMenuItem == this.selectedMenuOption)
                return;

            var menuStart = GetMenuSelectorPosition(this.selectedMenuOption);
            var menuEnd = GetMenuSelectorPosition(newMenuItem);
            menuSelectorUpDownTranslationAnimation = new TranslationAnimation(menuStart.X, menuStart.Y, menuEnd.X, menuEnd.Y, 0.0f, MenuConstants.MenuTranslationTotalDuration)
                                          {
                                              OnComplete = () =>
                                              {
                                                  this.selectedMenuOption = newMenuItem;
                                                  this.menuSelectorUpDownTranslationAnimation = null;
                                              },
                                          };
            menuSelectorUpDownTranslationAnimation.LogName = "Selector Up Translation";

            menuSelectorUpDownTranslationAnimation.AddVerticalEasing(0.0f, 0.5f, 0.1f, 1.0f);
            menuSelectorUpDownTranslationAnimation.AddVerticalEasing(0.5f, 1.0f, 1.0f, 0.1f);
        }
Beispiel #6
0
 private void CreateIntroAnimations()
 {
     // This is a teleport icon that comes in from the top.
     var menuSelectorIntroFrameAnimation = new Frame2DAnimation(MenuConstants.MenuSelectorIntroImages,
                                                                          new Tuple<float, int>[]
                                                                             {
                                                                                 new Tuple<float, int>(0.0f, 0),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration, 1),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration + 0.05f, 2),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration + 0.07f, 3),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration + 0.09f, 4),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration + 0.11f, 5),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration + 0.13f, 6),
                                                                                 new Tuple<float, int>(MenuConstants.IntroTeleportDuration + 0.15f, 7),
                                                                             });
     menuSelectorIntroFrameAnimation.OnComplete = () =>
     {
         // Go back to the Blinking animation.
         UseSelectorEnterAnimation = false;
         this.menuSelectorFrameAnimation.TrueAnimation.Reset();
         this.menuSelectorIntroAnimation = null;
     };
     menuSelectorIntroFrameAnimation.LogName = "Selector Intro Frame Animation";
     // Teleporting in, translating down to the first menu option (the default selected one). The total duration should match the Frame Animation, which has no easing specified,
     // up to the point of the first image (the teleport image).
     // Note that we offset the Y value so that the translation ends where our first Idle image needs to appear. This is done by simply subtracting the difference of the two frames and
     // centering, where the Intro Image is taller than the Idle Image.
     var menuStart = GetMenuSelectorPosition(this.selectedMenuOption, menuSelectorIntroFrameAnimation);
     var menuSelectorIntroTranslationAnimation = new TranslationAnimation(menuStart.X, -100, menuStart.X, menuStart.Y - (MenuConstants.MenuSelectorIntroImages[0].Height - MenuConstants.MenuSelectorIdleImages[0].Height) / 2, MenuConstants.IntroTeleportDuration);
     menuSelectorIntroTranslationAnimation.LogName = "Selector Intro Translation Animation";
     menuSelectorIntroAnimation = new Frame2DTranslationAnimation(menuSelectorIntroFrameAnimation, menuSelectorIntroTranslationAnimation);
 }