private void PickUpAction(PickUpItem pickUpItem)
 {
     _soundEffect.Play();
     _success.Play();
     ScoreHandler.AddPoint();
     pickUpItem.Sprite.Alive = false;
 }
        private bool CheckIfPlayerPickUpItem(PickUpItem pickUpItem, Rectangle targetRectangel, bool allItemIsCollected)
        {
            ItemIsPickedUp(pickUpItem, targetRectangel);

            if (pickUpItem.Sprite.Alive)
                allItemIsCollected = false;
            return allItemIsCollected;
        }
 public void CreatePickUpItems()
 {
     if (_game != null)
     {
         _pickUpItems = new List<PickUpItem>();
         for (var i = 0; i < _numberOfPickUpItems; i++)
         {
             var pickUpItem = new PickUpItem(_game);
             _pickUpItems.Add(pickUpItem);
         }
     }
 }
 public static void PlaceItem(int itemCount, List<Platform> platforms, PickUpItem pickUpItem)
 {
     var array = new byte[8];
     var random1 = new Random();
     random1.NextBytes(array);
     var random = array[itemCount] % platforms.Count;
     var valueForItemPlacement = 200;
     if (platforms[random].GetLength() < 5)
     {
         valueForItemPlacement = 100;
     }
     var onPlatform = array[itemCount] % valueForItemPlacement;
     pickUpItem.Sprite.Position.X = platforms[random].GetPostionX() + onPlatform;
     pickUpItem.Sprite.Position.Y = platforms[random].GetPostionY() - 40;
     pickUpItem.Sprite.Alive = true;
 }
 private void ItemIsPickedUp(PickUpItem pickUpItem, Rectangle targetRectangel)
 {
     if (pickUpItem.GetFloorRec().Intersects(targetRectangel) && pickUpItem.Sprite.Alive)
         PickUpAction(pickUpItem);
 }