Ejemplo n.º 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 };
 }
Ejemplo n.º 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 };
 }
Ejemplo n.º 5
0
 /// <summary>
 ///     Returns the top left of the specified Frame Animation to allow for the center of the image to be vertically centered with the text, but with some pixels between the right of the image and the left of the text.
 ///     If the Frame Animation specified is null, then the Idle or Enter frame will be used based on the UseIdleAnimation and UseEnteranimation flags.
 /// </summary>
 private Vector2 GetMenuSelectorPosition(MenuConstants.MenuOption menuOption, Frame2DAnimation menuSelectorFrameAnimation = null)
 {
     var frame = (menuSelectorFrameAnimation == null) ? this.menuSelectorFrameAnimation.Animation.CurrentFrame : menuSelectorFrameAnimation.CurrentFrame;
     var menuTextPosition = GetMenuTextPosition(menuOption);
     return new Vector2(menuTextPosition.X - frame.Width - 25, menuTextPosition.Y + (MenuConstants.MenuItemFont.LineSpacing / 2) - frame.Height / 2);
 }
Ejemplo n.º 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);
 }