Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            InputUtils.Update();
            MyMouse.Update();

            switch (state)
            {
            case GameState.Menu:
                screenMenu.Update(gameTime);
                break;

            case GameState.Practice:
                break;

            case GameState.TimeAttack:
                break;

            case GameState.Survival:
                screenSurvival.Update(gameTime);
                break;

            case GameState.Exit:
                Exit();
                break;

            default:
                break;
            }
        }
Exemplo n.º 2
0
        private void UpdateIdle(GameTime gameTime)
        {
            rPractice.Y   = (int)(150 + (Math.Cos(gameTime.TotalGameTime.TotalMilliseconds * 0.003) * 5));
            rBackCloud.Y  = (int)(100 + (Math.Cos(gameTime.TotalGameTime.TotalMilliseconds * 0.001) * 10));
            rTimeAttack.Y = (int)(150 + (Math.Cos(gameTime.TotalGameTime.TotalMilliseconds * 0.0035) * 5));
            rSurvival.Y   = (int)(MyGraphics.screenRect.Height / 2 - 150 + (Math.Cos(gameTime.TotalGameTime.TotalMilliseconds * 0.0032) * 5));

            if (MyMouse.IsLeftPressed())
            {
                if (rSurvival.Contains(MyMouse.GetPointPosition()))
                {
                    // Go to time attack mode
                    Game1.state = GameState.Survival;
                }
                else if (rPractice.Contains(MyMouse.GetPointPosition()))
                {
                    // Go to Practice mode
                    Game1.state = GameState.Practice;
                }
                else if (rClose.Contains(MyMouse.GetPointPosition()))
                {
                    Game1.state = GameState.Exit;
                }
                else if (rTimeAttack.Contains(MyMouse.GetPointPosition()))
                {
                    // Go to time attack mode
                    Game1.state = GameState.TimeAttack;
                }
            }
            if (InputUtils.gesture == PXCMGesture.Gesture.Label.LABEL_NAV_SWIPE_UP)
            {
                msState = MenuState.IdleToAbout;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();
            MyGraphics.Init(spriteBatch, graphics);
            InputUtils.Init();
            MyMouse.Init();

            // Game Vars
            state = GameState.Menu;

            // Screens
            screenMenu     = new Menu();
            screenSurvival = new Survival();

            // Init Screens
            screenMenu.Init();
            screenSurvival.Init();
        }