Пример #1
0
        /*==COMPONENT BASED==*/
        public void Update(GameTime gameTime, Sprite_Arena arena, List<Sprite_Table> tableList, Rectangle clientBounds)
        {
            //backup position
            old_position = position;

            //update state
            this.previousGPState = currentGPState;
            this.currentGPState = GamePad.GetState(index);

            if (my_player.Powerup != null)
            {

                if (currentGPState.Buttons.Y == ButtonState.Released && previousGPState.Buttons.Y == ButtonState.Pressed)
                {
                    powerupstart = gameTime.TotalGameTime;
                    my_player.Powerup.Powerup.applyEffect(my_player);
                    my_player.isPowerUpActive = true;
                }

                if (my_player.isPowerUpActive)
                {
                    my_player.Powerup.PositionX = this.position.X + (this.Dimension.X / 2 - my_player.Powerup.Dimension.X / 2);
                    my_player.Powerup.PositionY = this.Position.Y + my_player.Powerup.Dimension.Y;
                    if (gameTime.TotalGameTime.Subtract(powerupstart).Seconds == my_player.Powerup.Powerup.TimeLimit)
                    {
                        my_player.Powerup.Powerup.removeEffect(my_player);
                        my_player.Powerup = null;
                        my_player.isPowerUpActive = false;
                    }
                }
            }

            //Move le sprite
            position += direction;
            updateAnimation(gameTime, clientBounds);

            //ARENA BOUNDS CHECK
            arena.Bounds(this, old_position);

            //TABLE CHECK
            foreach (Sprite_Table t in tableList)
            {
                //check movement
                t.Bounds(this, old_position);

                //add/drop items on appropriate table
                t.ItemManager(this);

            }

            //UPDATE PLAYER CLASS (grabbed items, etc)
            my_player.Update();

            updateScoreOutput(dispTime);

            //base class(frame animation) - we deviate from base class here
            //because we want access to controller logic.  animation implemented in updateAnimation();
            //base.Update(gameTime, clientBounds);
        }
Пример #2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            Vector2 center = new Vector2(Game.Window.ClientBounds.Width / 2, Game.Window.ClientBounds.Height / 2);

            //==LOADASSETS==
            assetManager.LoadTextures();
            assetManager.LoadSounds();
            assetManager.LoadCustomerNames();
            //see AssetManager for definitions - we have a class with static positions
            //perhaps we can change later, kept for conformity sake
            assetManager.LoadCustomerAssets();
            //assetManager.LoadPowerUps();

            //==LOADARENA()==
            arena = new Sprite_Arena(assetManager.GetTextures("arenaTop"), assetManager.GetTextures("arenaBottom"),
                new Vector2(0, 100), new Vector2(0, Game.Window.ClientBounds.Height + 100 - assetManager.GetTextures("arenaBottom").Height));

            //==LOADPLAYERS()==
            LoadPlayers();

            //==LOAD TABLES()==
            LoadTables();

            LoadPowerups();

            //==CUSTOMERS() ==
            //CustomerManager();

            //==INFOPANEL==
            iPanel = new InfoPanel(playerList, assetManager, ((Game2)Game).Time);

            base.LoadContent();
        }