/// <summary> /// Creates a new Returnable Item. /// Textures and attributes of the Item are assigned by passed-in Type /// from list constructor (above) through a switch statement. /// </summary> /// <param name="type">Type of Returnable Item</param> public returnableItem(returnablesLIST.Type newType) { #region SWITCH FOR TYPE OF RETURNABLE switch (newType) { case returnablesLIST.Type.glass: type = newType; break; case returnablesLIST.Type.plastic: type = newType; break; case returnablesLIST.Type.can: type = newType; break; } #endregion }
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> /// Updates the Texture and Position of the Hand Images /// </summary> /// <param name="gameTime"></param> void UpdateHands(GameTime gameTime) { if (HAND.isEmpty) { HAND.switchType(hand_empty, 8); HAND2.switchType(hand_empty, 8); if (input != null) { if ((input.RightMBDown || input.BPress) && Player.INVENTORY.BOTTLES.Count != 0) { HAND.isEmpty = false; currentType = Player.INVENTORY.BOTTLES[0].type; switch (currentType) { case returnablesLIST.Type.glass: HAND.switchType(hand_glass, 44); HAND2.switchType(hand_glass, 44); break; case returnablesLIST.Type.plastic: HAND.switchType(hand_plastic, 41); HAND2.switchType(hand_plastic, 41); break; case returnablesLIST.Type.can: HAND.switchType(hand_can, 39); HAND2.switchType(hand_can, 39); break; } } } } //Update Shaking Below #region SHAKING Vector2 Direction = new Vector2(1, 1); if (snapshot != 5) { snapshot++; } else { snapshot = 0; if (input != null) handPosition1 = input.Mouse; handPosition2 = BLUR.BlurRect2q4; } handPosition1.X += (float)(Direction.X * 10 * Player.VISUALS.stat[2] * (Player.intoxicationLevel / 100)); handPosition1.Y += (float)(Direction.Y * 10 * Player.VISUALS.stat[2] * (Player.intoxicationLevel / 100)); handPosition2.X += (float)(Direction.X * 10 * Player.VISUALS.stat[2] * (Player.intoxicationLevel / 100)); handPosition2.Y += (float)(Direction.Y * 10 * Player.VISUALS.stat[2] * (Player.intoxicationLevel / 100)); #endregion #region CONTROL OUTER BOUNDS OF HAND if (handPosition1.X < 0) handPosition1.X = 0; if (handPosition1.X > ScreenManager.GlobalOptions.SCREEN_WIDTH - HUDbackground2.Width) handPosition1.X = ScreenManager.GlobalOptions.SCREEN_WIDTH - HUDbackground2.Width; if (handPosition1.Y < HUDbackground1.Height) handPosition1.Y = HUDbackground1.Height; if (handPosition1.Y > ScreenManager.GlobalOptions.SCREEN_WIDTH - HUDbackground1.Height) handPosition1.Y = ScreenManager.GlobalOptions.SCREEN_WIDTH - HUDbackground1.Height; #endregion HAND.Update(gameTime, handPosition1); HAND2.Update(gameTime, handPosition2); }