public override void Update(GameTime aGameTime, gameObjects aGameObjects)
 {
     if (Location.Y > gameBoundaries.Height + 300)
     {
         Location.Y = _random.Next(-500, 0);
         Location.X = _random.Next(0, (int)gameBoundaries.Width);
     }
     if(_trashType == TrashType.Recycle && boundingBox.Intersects(aGameObjects.RecycleBin.boundingBox))
     {
         aGameObjects.Score.PlayerScore += 10;
     }
     else if (_trashType == TrashType.Recycle && boundingBox.Intersects(aGameObjects.TrashBin.boundingBox))
     {
         aGameObjects.Score.PlayerScore -= 5;
     }
     if (_trashType == TrashType.Trash && boundingBox.Intersects(aGameObjects.TrashBin.boundingBox))
     {
         aGameObjects.Score.PlayerScore += 10;
     }
     else if (_trashType == TrashType.Trash && boundingBox.Intersects(aGameObjects.RecycleBin.boundingBox))
     {
         aGameObjects.Score.PlayerScore -= 5;
     }
     else if (Velocity.Y == 0 && aGameObjects.RecycleBin.Velocity.X != 0)  //Change to Game Started.....
     {
         var newVelocity = new Vector2(0f, 4.5f);
         Velocity = newVelocity;
     }
     base.Update(aGameTime, aGameObjects);
 }
 public void Update(GameTime gameTime, gameObjects gameObjects)
 {
     //if (gameObjects.Ball.Location.X + gameObjects.Ball.Width < 0)
     //{
     //    ComputerScore++;
     //    gameObjects.Ball.AttachTo(gameObjects.PlayerPaddle);
     //}
     //else if (gameObjects.Ball.Location.X > gameBoundaries.Width)
     //{
     //    PlayerScore++;
     //    gameObjects.Ball.AttachTo(gameObjects.PlayerPaddle);
     //}
 }
 public override void Update(GameTime gameTime, gameObjects gameObjects)
 {
     base.Update(gameTime, gameObjects);
 }
 public virtual void Update(GameTime gameTime, gameObjects gameObjects)
 {
     Location += Velocity;
     CheckBounds();
 }
        public override void Update(GameTime aGameTime, gameObjects aGameObjects)
        {
            if ((Location.X == 0 || Location.X == (gameBoundaries.Width - _texture.Width)))
               {
               if (Velocity != Vector2.Zero)
               {
                   var newVelocity = Vector2.Zero;
                   Velocity = newVelocity;
                   _mouseMove = false;
               }
               }
               var touchPoint = TouchPanel.GetState().FirstOrDefault();
               if (touchPoint.State != TouchLocationState.Invalid)
               {
               _mouseMove = true;
               touchPosition = new Vector2(touchPoint.Position.X, 0f);
               }
               else if (Mouse.GetState().LeftButton == ButtonState.Pressed)
               {   // Add touch
               //Mouse overrides keyboard input
               //Mouse and Touch shoudl be handled as same event sort of so they don't compete
               _mouseMove = true;
               touchPosition = new Vector2(Mouse.GetState().X , 0f);
               }
               if (_mouseMove)
               {
               if ((touchPosition.X < (Location.X + Width / 2) + 10f) && (touchPosition.X > (Location.X + Width / 2) - 10f))
               {
                   _mouseMove = false;
                   Velocity = Vector2.Zero;

               }
               else if (touchPosition.X > Location.X + Width / 2)
               {
                   var newVelocity = new Vector2(6f, 0);
                   Velocity = newVelocity;
               }
               else if (touchPosition.Y < Location.Y + Height / 2)
               {
                   var newVelocity = new Vector2(-6f, 0);
                   Velocity = newVelocity;
               }
               }
               else if (Keyboard.GetState().IsKeyDown(Keys.Left))
                    {
                        var newVelocity = new Vector2(-6f, 0);
                        Velocity = newVelocity;
                    }
                    else if (Keyboard.GetState().IsKeyDown(Keys.Right))
                    {
                        var newVelocity = new Vector2(6f, 0);
                        Velocity = newVelocity;
                    }
                    else if (Keyboard.GetState().IsKeyDown(Keys.Up) || Keyboard.GetState().IsKeyDown(Keys.Down))
                    {
                        var newVelocity = Vector2.Zero;
                        Velocity = newVelocity;
                    }

               base.Update(aGameTime, aGameObjects);
        }
        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            _gameBoundaries = new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height);

            // Abstract to Level Defined Method or some ish.....

            var random = new Random();

            var trashItem1Texture = Content.Load<Texture2D>("trash1");
            var trashItemLocation = new Vector2(_gameBoundaries.Width / 2 - random.Next(-800, 1000), 0f);
            var trashItem1 = new trashItem(trashItem1Texture, trashItemLocation, _gameBoundaries);
            trashItem1.setTrashType(TrashType.Trash);

            var recycleItem1Texture = Content.Load<Texture2D>("recycle1");
            var recylceItemLocation = new Vector2(_gameBoundaries.Width / 2 - random.Next(-1000, 800), 0f);
            var recycleItem1 = new trashItem(recycleItem1Texture, recylceItemLocation, _gameBoundaries);
            recycleItem1.setTrashType(TrashType.Recycle);

            //Abstract to Level Defined Method or some ish.....

            var trashBinTexture = Content.Load<Texture2D>("trashBin");
            var trashBinLocation = new Vector2(_gameBoundaries.Width/2 + 50f, _gameBoundaries.Height - 100f);
            var trashBin = new playerBin(trashBinTexture, trashBinLocation, _gameBoundaries);
            trashBin.setBinType(TrashType.Trash);

            var recycleBinTexture = Content.Load<Texture2D>("recycleBin");
            var recycleBinLocation = new Vector2(_gameBoundaries.Width/2 - 50f, _gameBoundaries.Height - 100f);
            var recycleBin = new playerBin(recycleBinTexture, recycleBinLocation, _gameBoundaries);
            recycleBin.setBinType(TrashType.Recycle);

            var iconTexture = new Texture2D(GraphicsDevice, 100, 100);
            iconTexture = Content.Load<Texture2D>("RecyCloneIcon");
            var icon = new Icon(iconTexture, Vector2.Zero, _gameBoundaries);

            // Score Creation
            var spriteFontTexture = Content.Load<SpriteFont>("font");
            var score = new Score(spriteFontTexture, _gameBoundaries);

            _gameObjects = new gameObjects();
            _gameObjects.TrashBin = trashBin;
            _gameObjects.RecycleBin = recycleBin;
            _gameObjects.Score = score;
            _gameObjects.Icon = icon;
            _gameObjects.trashItem1 = trashItem1;
            _gameObjects.recycleItem1 = recycleItem1;
            _gameObjects.Score = score;
        }