Example #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)
        {
            MouseState mouseState = Mouse.GetState();

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            // TODO: Add your update logic here
            try
            {
                KeyboardState keyboardState = Keyboard.GetState();
                if (keyboardState.IsKeyDown(Keys.Escape))
                    this.Exit();
            }
            catch
            {
            }

            switch (estado)
            {
                case estados.seleccion:
                    tiempoPasado++;
                    if (tiempoPasado > tiempoEspera)
                    {

                        if (mouseState.LeftButton == ButtonState.Pressed)
                        {
                            tiempoPasado = 0;
                            tiempoEspera = 100;
                            modelManager = null;
                            botonManager = null;
                            if (mouseState.X > (screenWidth / 2))
                            {
                                femeninooSeleccionado();
                            }
                            else
                            {
                                masculinoSeleccionado();
                            }
                        }
                    }

                    break;
                case estados.juego:
                    if (botonManager.estado == estados.fin)
                        estado = estados.fin;
                    break;
                case estados.fin:
                    tiempoPasado++;
                    if (tiempoPasado > tiempoEspera*2)
                        if (mouseState.LeftButton == ButtonState.Pressed)
                        {
                            estado = estados.seleccion;
                            botonManager.estado = estados.seleccion;
                            modelManager.estado = estados.seleccion;
                            spriteManager.Enabled = true;
                            spriteManager.Visible = true;
                            tiempoPasado = 0;
                            tiempoEspera = 10;
                        }
                    break;
            }
            base.Update(gameTime);
        }
Example #2
0
 void masculinoSeleccionado()
 {
     modelManager = new ModelManager(this, ModelManager.sexo.Masculino, screenHeight, screenWidth);
     Components.Add(modelManager);
     spriteManager.Enabled = false;
     spriteManager.Visible = false;
     botonManager = new BotonManager(this, modelManager.models, screenHeight, screenWidth);
     Components.Add(botonManager);
     estado = estados.juego;
 }
Example #3
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)
        {
            MouseState mouseState = Mouse.GetState();

            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            // TODO: Add your update logic here
            try
            {
                KeyboardState keyboardState = Keyboard.GetState();
                if (keyboardState.IsKeyDown(Keys.Escape))
                {
                    this.Exit();
                }
            }
            catch
            {
            }

            switch (estado)
            {
            case estados.seleccion:
                tiempoPasado++;
                if (tiempoPasado > tiempoEspera)
                {
                    if (mouseState.LeftButton == ButtonState.Pressed)
                    {
                        tiempoPasado = 0;
                        tiempoEspera = 100;
                        modelManager = null;
                        botonManager = null;
                        if (mouseState.X > (screenWidth / 2))
                        {
                            femeninooSeleccionado();
                        }
                        else
                        {
                            masculinoSeleccionado();
                        }
                    }
                }

                break;

            case estados.juego:
                if (botonManager.estado == estados.fin)
                {
                    estado = estados.fin;
                }
                break;

            case estados.fin:
                tiempoPasado++;
                if (tiempoPasado > tiempoEspera * 2)
                {
                    if (mouseState.LeftButton == ButtonState.Pressed)
                    {
                        estado = estados.seleccion;
                        botonManager.estado   = estados.seleccion;
                        modelManager.estado   = estados.seleccion;
                        spriteManager.Enabled = true;
                        spriteManager.Visible = true;
                        tiempoPasado          = 0;
                        tiempoEspera          = 10;
                    }
                }
                break;
            }
            base.Update(gameTime);
        }