Exemplo n.º 1
0
    protected override void Update(GameTime gameTime)
    {
        HandleInput();
        multiplayerManager.Update(gameTime);
        gameStateManager.Update(gameTime);
        ScreenFade.Update(gameTime);
        if (quitGame)
        {
            Exit();
        }

        int outputx = 0;

        for (int i = output.Count - 1; i >= 0; i--)
        {
            output[i].Update(gameTime);
            if (output[i].Timer <= 0)
            {
                output.RemoveAt(i);
            }
            else
            {
                output[i].Position = new Vector2(60, outputx);
                outputx           += 30;
            }
        }
    }
Exemplo n.º 2
0
    public static int Update(IntPtr l)
    {
        int result;

        try
        {
            ScreenFade screenFade = (ScreenFade)LuaObject.checkSelf(l);
            float      dt;
            LuaObject.checkType(l, 2, out dt);
            screenFade.Update(dt);
            LuaObject.pushValue(l, true);
            result = 1;
        }
        catch (Exception e)
        {
            result = LuaObject.error(l, e);
        }
        return(result);
    }
Exemplo n.º 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)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }

            // TODO: Add your update logic here

            base.Update(gameTime);


            Globals.UpdateGlobals();

            if (screenFade.Active)
            {
                screenFade.Update();
            }

            if (Globals.Gamestate == Globals.MENU)
            {
                if (screenFade.Active && inMenu)
                {
                    Reset();
                }

                paused = false;
                if (startBtn.CheckButton() && !screenFade.Active)
                {
                    screenFade.Start(Globals.BET, 1f);
                    inMenu = false;
                }

                maxVel = 0;

                foreach (Animal animal in animals)
                {
                    animal.Update();
                    if (animal.Vel > maxVel)
                    {
                        maxVel = animal.Vel;
                    }
                }

                if (FinishLine >= 800)
                {
                    ScrollLine += maxVel;
                    FinishLine -= maxVel;
                    if (FinishLine <= 6200)
                    {
                        scrollBg.Update(maxVel);
                    }
                }
            }
            else if (Globals.Gamestate == Globals.BET)
            {
                if (screenFade.Active && currentBet == 0)
                {
                    Reset();
                }

                for (int i = 0; i < betButtons.Count; i++)
                {
                    if (betButtons[i].CheckButton() && animals[i].Bet < 1 && currentBet < 3)
                    {
                        if (currentBet == 0)
                        {
                            animals[i].Bet = 1;
                        }
                        else if (currentBet == 1)
                        {
                            animals[i].Bet = 2;
                        }
                        else
                        {
                            animals[i].Bet = 3;
                        }
                        currentBet++;
                        bets.Add(i);
                    }
                }

                if (currentBet >= 3)
                {
                    if (startBtn.CheckButton() && !screenFade.Active)
                    {
                        screenFade.Start(Globals.GAMEPLAY, 1f);
                    }
                }
            }
            else
            {
                if (!screenFade.Active)
                {
                    maxVel = 0;

                    if (places.Count == 0)
                    {
                        if (startBtn.CheckButton())
                        {
                            screenFade.Start(Globals.MENU, 1f);
                            inMenu = true;
                        }
                    }

                    if (paused)
                    {
                        if (pauseTimer.Check())
                        {
                            paused = false;
                        }
                        else
                        {
                            pauseTimer.Update();
                        }
                    }
                    else
                    {
                        foreach (Animal animal in animals)
                        {
                            animal.Update();
                            if (animal.Vel > maxVel)
                            {
                                maxVel = animal.Vel;
                            }
                        }

                        if (FinishLine >= 800)
                        {
                            ScrollLine += maxVel;
                            FinishLine -= maxVel;
                            if (FinishLine <= 6200)
                            {
                                scrollBg.Update(maxVel);
                            }
                        }
                    }
                }
            }
        }