/// <summary>
 /// Constructor
 /// </summary>
 public ShopScreen(character player, double fadeSpeed_X, double fadeSpeed_Y)
 {
     TransitionOnTime = TimeSpan.FromSeconds(.5);
     TransitionOffTime = TimeSpan.FromSeconds(.5);
     this.Player = player;
     this.fadeSpeed_X = fadeSpeed_X;
     this.fadeSpeed_Y = fadeSpeed_Y;
     IsPaused = false;
 }
 public bool CheckCollisions(GameTime gTime, GameplayScreen screen, character Player, Vector2 mousePos,
                                 GameplayScreen.playerHand hand)
 {
     #region MACHINE HIT
     if (mouseIsInside(mousePos, hitbox) && currentSound.State != SoundState.Playing && !hand.isEmpty)
     {
         if (this.machineType == global::bottleReturn.machineType.CANS)
         {
             if (Player.INVENTORY.BOTTLES[0].type == returnablesLIST.Type.can)
             {
                 Player.INVENTORY.BOTTLES.RemoveAt(0);       // Remove Current Bottle From Player's Inventory
                 if (screen.ScreenManager.GlobalOptions.SOUND_ENABLE)
                 {
                     currentSound.Play();
                 }
                 currentValue += .05;
                 hand.isEmpty = true;
                 //SCORE MARKER
                 Player.score += 5 * ((int)Player.intoxicationLevel + (int)Player.wantedLevel + (int)Player.odorLevel);
                 Player.energy -= 0.75f * (Player.odorLevel / 100);
                 Player.odorLevel += 0.25f;
             }
             else
             {
                 rejectBottleOccupado = true;
                 rejectBottleType = Player.INVENTORY.BOTTLES[0].type;
                 hand.isEmpty = true;
                 Player.INVENTORY.BOTTLES.RemoveAt(0);
                 Player.energy -= 0.375f * (Player.odorLevel / 100);
                 Player.odorLevel += 0.25f;
                 // Play bottle reject sound
             }
         }
         if (this.machineType == global::bottleReturn.machineType.GLASS)
         {
             if (Player.INVENTORY.BOTTLES[0].type == returnablesLIST.Type.glass)
             {
                 Player.INVENTORY.BOTTLES.RemoveAt(0);       // Remove Current Bottle From Player's Inventory
                 if (screen.ScreenManager.GlobalOptions.SOUND_ENABLE)
                 {
                     currentSound.Play();
                 }
                 currentValue += .05;
                 hand.isEmpty = true;
                 //SCORE MARKER
                 Player.score += 5 * ((int)Player.intoxicationLevel + (int)Player.wantedLevel);
                 Player.energy -= 0.75f * (Player.odorLevel / 100);
                 Player.odorLevel += 0.50f;
             }
             else
             {
                 rejectBottleOccupado = true;
                 rejectBottleType = Player.INVENTORY.BOTTLES[0].type;
                 hand.isEmpty = true;
                 Player.INVENTORY.BOTTLES.RemoveAt(0);
                 Player.energy -= 0.375f * (Player.odorLevel / 100);
                 Player.odorLevel += 0.50f;
                 // Play bottle reject sound
             }
         }
         if (this.machineType == global::bottleReturn.machineType.PLASTIC)
         {
             if (Player.INVENTORY.BOTTLES[0].type == returnablesLIST.Type.plastic)
             {
                 Player.INVENTORY.BOTTLES.RemoveAt(0);       // Remove Current Bottle From Player's Inventory
                 if (screen.ScreenManager.GlobalOptions.SOUND_ENABLE)
                 {
                     currentSound.Play();
                 }
                 currentValue += .05;
                 hand.isEmpty = true;
                 //SCORE MARKER
                 Player.score += 5 * ((int)Player.intoxicationLevel + (int)Player.wantedLevel);
                 Player.energy -= 0.75f * (Player.odorLevel / 100);
                 Player.odorLevel += 0.50f;
             }
             else
             {
                 rejectBottleOccupado = true;
                 rejectBottleType = Player.INVENTORY.BOTTLES[0].type;
                 hand.isEmpty = true;
                 Player.INVENTORY.BOTTLES.RemoveAt(0);
                 Player.energy -= 0.375f * (Player.odorLevel / 100);
                 Player.odorLevel += 0.50f;
                 // Play bottle reject sound
             }
         }
         return true;
     }
     #endregion
     #region TICKET HIT
     if (mouseIsInside(mousePos, ticketHitbox) && currentValue != 0 && hand.isEmpty)
     {
         Player.VOUCHERS.Add(new ticket(currentValue));
         if (screen.ScreenManager.GlobalOptions.SOUND_ENABLE)
         {
             ticketSound.Play();
         }
         currentValue = 0;
         //SCORE MARKER
         Player.score += 10 * ((int)Player.intoxicationLevel + (int)Player.wantedLevel);
         Player.energy -= 0.10f * (int)(Player.odorLevel / 100);
         Player.odorLevel += 0.125f;
         return true;
     }
     #endregion
     #region BOTTLE REJECT HIT
     if (mouseIsInside(mousePos, rejectHitbox) && hand.isEmpty)
     {
         // Picking a bottle back up.
         rejectBottleOccupado = false;
         Player.INVENTORY.BOTTLES.Add(new returnableItem(rejectBottleType));
         //SCORE MARKER
         Player.score += 2 * ((int)Player.intoxicationLevel + (int)Player.wantedLevel);
         Player.energy -= 0.25f * (int)(Player.odorLevel / 100);
         Player.odorLevel += 0.125f;
     }
     #endregion
     #region MISS
     // If none of the above happen, we will always return false.
     if (!hand.isEmpty)
         return false;
     #endregion
     // If we got through all of the above, then our
     // hand is empty and we are just clicking randomly.
     return true;
 }
        /// <summary>
        /// Creates a new List of Availiable Characters for use by the player.
        /// </summary>
        /// <param name="texture1"></param>
        /// <param name="texture2"></param>
        /// <param name="texture3"></param>
        /// <param name="texture4"></param>
        public characterLIST(Texture2D texture1, Texture2D texture2,
                                Texture2D texture3, Texture2D texture4)
        {
            CHARACTERS = new List<character>();
            character[] temp = new character[listSize];

            temp[0] = new character(0.375f, 0.80f, 0.40f, 0.65f, 12, 0.85f, 0.90f, "Muddy Mike",
                                        0.70f, 0.25f, 0.35f, texture1);
            temp[1] = new character(0.500f, 0.60f, 0.80f, 0.15f, 18, 0.75f, 0.50f, "John Doe",
                                        0.50f, 0.55f, 0.60f, texture2);
            temp[2] = new character(0.675f, 0.40f, 0.20f, 0.40f, 16, 0.60f, 0.25f, "Bob",
                                        0.10f, 0.90f, 0.25f, texture3);
            temp[3] = new character(0.755f, 0.20f, 0.60f, 0.90f, 20, 0.50f, 0.75f, "Dirty Sanchez",
                                        0.25f, 0.75f, 0.80f, texture4);

            for (int index = 0; index < listSize; index++)
            {
                CHARACTERS.Add(temp[index]);
            }
        }
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(character player)
        {
            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            input = new InputHandler(GamePad.GetState(PlayerIndex.One), Keyboard.GetState(), Mouse.GetState());
            debugMouseAlpha = new Color(255, 255, 255, (byte)0.5);
            Player = player;
            rotation = 0;
            rotationDirection = new Vector2(-1 , 0);
            fadeDirection = new Vector2(1 , 1);
            backgroundScale = 1.25;
            hitboxScale = MathHelper.Clamp((1 - (Player.intoxicationLevel / 100)), 0.40f, 1.00f);
            machineFadeSpeed_X = 1;
            machineFadeSpeed_Y = 1;
            confrontationInterval = random.Next(30000, 300000);
        }
        public void CheckCollisions(GameTime gTime, GameplayScreen screen, character Player, bool buttonClick, Vector2 mousePos,
                                        GameplayScreen.playerHand hand, GameplayScreen.playerHand hand2)
        {
            bool hit = false;

            if (buttonClick)
            {
                foreach (machine index in machineArray)
                {
                    bool tempBool = index.CheckCollisions(gTime, screen, Player, mousePos, hand);
                    if (tempBool)
                        hit = tempBool;
                }
                if (hit == false && hand.isEmpty == false)
                {
                    #region RANDOM CHANCE OF DROP
                    if ((WOLOLOLO.NextDouble() < Player.DATA.stat[5]) &&
                            Player.INVENTORY.BOTTLES.Count > 0)
                    {
                        drop fallingItem = null;
                        drop fallingItem2;
                        if (Player.INVENTORY.BOTTLES[0].type == returnablesLIST.Type.glass)
                        {
                            hand.isEmpty = true;
                            fallingItem = new drop(glassReject, mousePos, snd_glassDrop, true, false);
                            fallingItem2 = new drop(glassReject, new Vector2(hand2.X, hand2.Y), snd_glassDrop, true, true);
                            fallingItems.Add(fallingItem);
                            fallingItems.Add(fallingItem2);
                        }
                        else if (Player.INVENTORY.BOTTLES[0].type == returnablesLIST.Type.can)
                        {
                            hand.isEmpty = true;
                            fallingItem = new drop(cansReject, mousePos, snd_canDrop, false, false);
                            fallingItem2 = new drop(cansReject, new Vector2(hand2.X, hand2.Y), snd_canDrop, false, true);
                            fallingItems.Add(fallingItem);
                            fallingItems.Add(fallingItem2);
                        }
                        else if (Player.INVENTORY.BOTTLES[0].type == returnablesLIST.Type.plastic)
                        {
                            hand.isEmpty = true;
                            fallingItem = new drop(plasticReject, mousePos, snd_plasticDrop, false, false);
                            fallingItem2 = new drop(plasticReject, new Vector2(hand2.X, hand2.Y), snd_plasticDrop, false, true);
                            fallingItems.Add(fallingItem);
                            fallingItems.Add(fallingItem2);
                        }

                        if (fallingItem != null && fallingItem.breakable)
                        {
                            Player.INVENTORY.BOTTLES.RemoveAt(0);
                        }
                        else if (Player.INVENTORY.BOTTLES[0] != null)
                        {
                            Player.INVENTORY.BOTTLES.Add(Player.INVENTORY.BOTTLES[0]);
                            Player.INVENTORY.BOTTLES.RemoveAt(0);
                        }

                    }
                    #endregion
                }
            }
        }
        public void Update(GameTime gTime, GameplayScreen screen, float hitBoxScale, float rotation,
                            character player, float fadeSpeed_X, float fadeSpeed_Y)
        {
            for (int index = 0; index < machineArray.Count; index++)
            {
                machineArray[index].Update(gTime, hitBoxScale, index, rotation, BgRect);
            }

            //foreach (drop index in fallingItems)
            for (int i=0;i<fallingItems.Count;i++)
            {
                if (fallingItems[i].fade)
                {
                    fallingItems[i].UpdateFade(gTime, new Vector2(0, dropSpeed));//new Vector2(fadeSpeed_X , fadeSpeed_Y));
                }
                else
                {
                    fallingItems[i].Update(gTime, new Vector2(0, dropSpeed));
                }
                if (fallingItems[i].getLocation().Y > 720)
                {
                    if (screen.ScreenManager.GlobalOptions.SOUND_ENABLE)
                    {
                        fallingItems[i].PlaySound();
                    }

                    fallingItems.RemoveAt(i);
                }
            }
        }
        /// <summary>
        /// Creates a new HUD for GamePlay Screen
        /// </summary>
        /// <param name="horizontalBar"></param>
        /// <param name="verticalBar"></param>
        /// <param name="powerBar1"></param>
        /// <param name="powerBar2"></param>
        /// <param name="statsFont"></param>
        /// <param name="screenWidth"></param>
        /// <param name="screenHeight"></param>
        /// <param name="Player"></param>
        public gameplayHUD(Texture2D horizontalBar, Texture2D verticalBar, Texture2D powerBar1, Texture2D powerBar2,
                            Texture2D powerBar3, Texture2D smallBeer, Texture2D portraitTexture,
                            Texture2D paperBag, Texture2D trashBag, Texture2D cart,
                            SpriteFont statsFont, int screenWidth, int screenHeight, character Player)
        {
            beerHeight = (int)(horizontalBar.Height * 0.75);
            beerWidth = 12;
            this.Player = Player;
            this.smallBeer = smallBeer;
            containerImage = new Texture2D[3] { paperBag,
                                                trashBag,
                                                cart };
            reminderColor = Color.Black;
            fntAttribs = statsFont;
            #region BACKGROUND RECTANGLE ARRAY INITIALIZATION
            background = new Sprite[3];
            background[0] = new Sprite(horizontalBar, Vector2.Zero);
            background[1] = new Sprite(horizontalBar, new Vector2(0, screenHeight - horizontalBar.Height));
            background[2] = new Sprite(verticalBar, new Vector2(screenWidth - verticalBar.Width, 0));
            #endregion
            #region STATS RECTANGLE ARRAY INITIALIZATION
            statRectWidth = ((horizontalBar.Width - verticalBar.Width) / 2) - 10;
            statRectHeight = (int)(horizontalBar.Height * 0.75);

            intoxBar = new Bar(powerBar1, new Vector2(0, 8),
                new Rectangle(0, 0, statRectWidth, statRectHeight));

            odorBar = new Bar(powerBar3, new Vector2((((horizontalBar.Width - verticalBar.Width) / 2) + 10), 8),
                new Rectangle(0, 0, statRectWidth, statRectHeight));

            energy = new Bar(powerBar2, new Vector2(0, (screenHeight - horizontalBar.Height + 8)),
                new Rectangle(0, 0, statRectWidth, statRectHeight));

            wantedLevel = new Bar(powerBar1, new Vector2((((horizontalBar.Width - verticalBar.Width) / 2) + 10),
                (screenHeight - horizontalBar.Height + 8)),
                new Rectangle(0, 0, statRectWidth, statRectHeight));
            #endregion
            #region STAT BARS VECTOR2 ARRAY INITIALIZATION
            statLoc = new Vector2[6];
            for (int index = 0; index < 2; index++)
            {
                statLoc[index].X = (index * ((horizontalBar.Width - verticalBar.Width) / 2) + 10) + 4;
                statLoc[index].Y = 10;
            }
            for (int index = 0; index < 2; index++)
            {
                statLoc[index + 2].X = (index * ((horizontalBar.Width - verticalBar.Width) / 2) + 10) + 4;
                statLoc[index + 2].Y = (screenHeight - horizontalBar.Height + 8) + 2;
            }
            #endregion

            #region CHARACTER PORTRAIT INITIALIZATION
            this.portraitTexture = portraitTexture;
            portraitRect = new Rectangle(screenWidth - verticalBar.Width + 8, 8, 224, 268);
            #endregion
            #region CHARACTER INVENTORY INITIALIZATION
            inventoryLoc = new Vector2[7] { new Vector2(screenWidth - verticalBar.Width + 73, 345),
                                            new Vector2(1150, 390),
                                            new Vector2(screenWidth - verticalBar.Width + 16, 495),
                                            new Vector2(screenWidth - verticalBar.Width + 16, 525),
                                            new Vector2(screenWidth - verticalBar.Width + 16, 555),
                                            new Vector2(screenWidth - verticalBar.Width + 16, 585),
                                            new Vector2(screenWidth - verticalBar.Width + 58, 620) };
            #endregion
        }