//bubble //we use bubble as our "active" sprite public Sprite_Customer(string name, CustomerAsset asset, AssetManager assetManager, int level, int collisionOffset, Point currentFrame, Point sheetSize, Vector2 speed, int millisecondsPerFrame, SoundEffect collision_sound) : base(assetManager.GetTextures(asset.Bubble_file), asset.vBubble, new Point(assetManager.GetTextures(asset.Bubble_file).Width, assetManager.GetTextures(asset.Bubble_file).Height), collisionOffset, currentFrame, sheetSize, speed, 0, collision_sound) { this.name = name; this.asset = asset; this.assetManager = assetManager; this.level = level; this.my_customer = new Customer(this.Order(), level); //we use this because assets require scaling.... RECT_CUSTOMER.X = (int)asset.vCustomer.X; RECT_CUSTOMER.Y = (int)asset.vCustomer.Y; RECT_ORDER.X = (int)asset.vOrder.X; RECT_ORDER.Y = (int)asset.vOrder.Y; RECT_BUBBLE.X = (int)asset.vBubble.X; RECT_BUBBLE.Y = (int)asset.vBubble.Y; }
private void orderComparison(Player player, Customer current, GamePadState previousState, GamePadState padNow) { if (player.Carrying.Count() == 1 && (padNow.Buttons.LeftShoulder == ButtonState.Released && previousState.Buttons.LeftShoulder == ButtonState.Pressed || padNow.Triggers.Left < .5 && previousState.Triggers.Left > .5)) { updateOrder(player, current, 0); } else if (player.Carrying.Count() == 2) { //while most button presses occur after the button is released the right shoulder button //is processes here when the button is pressed. This solves the problem of pressing both //shoulder buttons at the same time and the left item being used if (padNow.Buttons.RightShoulder == ButtonState.Pressed || padNow.Triggers.Right > .5) { updateOrder(player, current, 1); } if (padNow.Buttons.LeftShoulder == ButtonState.Released && previousState.Buttons.LeftShoulder == ButtonState.Pressed || padNow.Triggers.Left < .5 && previousState.Triggers.Left > .5) { updateOrder(player, current, 0); } } else if (player.Carrying.Count() == 3) { if (padNow.Buttons.RightShoulder == ButtonState.Pressed || padNow.Triggers.Right > .5) { updateOrder(player, current, 1); } if (padNow.Buttons.LeftShoulder == ButtonState.Released && previousState.Buttons.LeftShoulder == ButtonState.Pressed || padNow.Triggers.Left < .5 && previousState.Triggers.Left > .5) { updateOrder(player, current, 0); } if (padNow.DPad.Up == ButtonState.Released && previousState.DPad.Up == ButtonState.Pressed) { updateOrder(player, current, 2); } } }
public void updateOrder(Player player, Customer current, int item) { //SCORING if (current.Order.Contains(player.Carrying[item])) { current.Order.Remove(player.Carrying[item]); player.Carrying.RemoveAt(item); player.ItemsServed = player.ItemsServed + 1; player.Score = player.Score + 5; assetManager.GetSounds("CashRegister").Play(); //serveSound.Play(); if (current.Order.Count == 0) { doneSounds(this.name); player.OrdersFinished = player.OrdersFinished + 1; if (current.Patience/1000 < 5) { player.CustomersSaved = player.CustomersSaved + 1; current.Bonus = current.Bonus + 3; } player.BonusPoints = player.BonusPoints + current.Bonus; player.Score += current.Bonus; } } else { assetManager.GetSounds("wrong item").Play(); //wrongItemSound.Play(); } }