Ejemplo n.º 1
0
        public void Update(GameTime gameTime, InputManager inputManager)
        {
            if (axis == 1)
            {
                if (inputManager.KeyPressed(Keys.Right))
                {
                    itemNumber++;
                }
                if (inputManager.KeyPressed(Keys.Left))
                {
                    itemNumber--;
                }
            }
            else
            {
                if (inputManager.KeyPressed(Keys.Down))
                {
                    itemNumber++;
                }
                if (inputManager.KeyPressed(Keys.Up))
                {
                    itemNumber--;
                }
            }

            if (inputManager.KeyDown(Keys.Enter))
            {
                if (linkType[itemNumber] == "Screen")
                {
                    Type newClass = Type.GetType("Game4." + linkID[itemNumber]);
                    ScreenManager.Instance.AddScreen((GameScreen)Activator.CreateInstance(newClass), inputManager);
                }
                if (linkType[itemNumber] == "Action")
                {
                    if (linkID[itemNumber] == "Quit")
                    {
                        Game1.exit = true;
                    }
                }
            }

            if (itemNumber < 0)
            {
                itemNumber = 0;
            }
            else if (itemNumber >= menuItems.Count)
            {
                itemNumber = menuItems.Count - 1;
            }

            for (int i = 0; i < animation.Count; i++)
            {
                Animation a = animation[i];
                for (int j = 0; j < animationTypes.Count; j++)
                {
                    if (itemNumber == i)
                    {
                        animation[i].IsActive = true;
                    }
                    else
                    {
                        animation[i].IsActive = false;
                    }


                    switch (animationTypes[j])
                    {
                    case "Fade":
                        fadeAnimation.Update(gameTime, ref a);
                        break;

                    case "SSheet":
                        ssAnimation.Update(gameTime, ref a);
                        break;
                    }
                }
                animation[i] = a;
            }
        }