Exemplo n.º 1
0
        public static void LoadAnimation()
        {
            MyMwcLog.WriteLine("MyTrailerLoad.LoadContent() - START");
            MyMwcLog.IncreaseIndent();
            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyTrailerLoad::LoadAnimation");

            if (!AnimationSelectedFromMenu)
            {
                MyTrailerXml res = LoadTrailerXml();
                Animations = res.Animation;

                if (MyGuiScreenGamePlay.Static.IsMainMenuActive())
                {
                    SetTrailerAnimation(res.MainMenuAnimation);
                }
                else if (MyGuiScreenGamePlay.Static.IsGameActive())
                {
                    SetTrailerAnimation(res.GameAnimation);
                }
                else if (MyGuiScreenGamePlay.Static.IsFlyThroughActive())
                {
                    if (string.IsNullOrEmpty(res.FlyThroughOrCreditsAnimation))
                    {
                        //  Pick random animation
                        if ((res.Animation != null) && (Animations.Length > 0))
                        {
                            TrailerAnimation = res.Animation[MyMwcUtils.GetRandomInt(0, Animations.Length)];
                        }
                    }
                    else
                    {
                        SetTrailerAnimation(res.FlyThroughOrCreditsAnimation);
                    }
                }
            }
            AnimationSelectedFromMenu = false;

            MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock();
            MyMwcLog.DecreaseIndent();
            MyMwcLog.WriteLine("MyTrailerLoad.LoadContent() - END");
        }
Exemplo n.º 2
0
 static void SetTrailerAnimation(string animationToPlay)
 {
     if (string.IsNullOrEmpty(animationToPlay))
     {
         TrailerAnimation = null;
     }
     else
     {
         //  Find animation by name
         if (Animations != null)
         {
             foreach (MyTrailerXmlAnimation tempAnimation in Animations)
             {
                 if (tempAnimation.Name == animationToPlay)
                 {
                     TrailerAnimation = tempAnimation;
                 }
             }
         }
     }
 }