public void SetShopItem(int price, ISellable item, Sprite icon) { itemPrice = price; priceText.text = itemPrice.ToString(); itemToSell = item; itemIcon.sprite = icon; }
public void SellProducts(ISellable product, int quantity, Market market) { int income = market.CalculateCost(product, quantity); var currency = this.GetFromInventoryByType(FarmFoodType.Raspberry); this.RemoveFromInventory(product); this.AddMultipleToInventory(currency, income); }
public void GetTheBestProduct() { visitor.visitTransaction(new Transaction(ProductGenerator.chips, 10, builder.john)); visitor.visitTransaction(new Transaction(ProductGenerator.water, 10, builder.john)); ISellable product = visitor.GetBestproduct(); Assert.Equal(1.0m, product.BuyPrice); }
public Dictionary <string, int> Sell(Player player, ISellable thing) { Dictionary <string, int> soldItem = new Dictionary <string, int> { { Name, Price } }; player.TakeGold((int)Math.Round((double)Price * 0.8)); return(soldItem); }
public void Sell(ref ISellable sellable) { var price = GameManager.Instance.SellPriceDictionaryService.GetSellPrice(sellable); GameManager.Instance.InventoryService.RemoveItemByType(sellable.GetType()); GameManager.Instance.MoneyService.MoneyAmount += price; sellable = null; }
void Awake() { upgrading = GetComponent <IUpgradable <AbstractDeveloper> >(); selling = GetComponent <ISellable <AbstractDeveloper> >(); if (instance != null) { return; } instance = this; }
public bool IsSameModel(ISellable anotherItem) { Component anotherComponent = (Component)anotherItem; if (anotherComponent != null) { return(GetModel() == anotherComponent.GetModel()); } else { return(false); } }
public void visitTransaction(Transaction transaction) { ISellable product = transaction._product; ISellable checkedproduct = GetSellableInDictionary(transaction._product._name); decimal price = transaction._client.GetAppropriatePrice(transaction._product); int quantity = transaction._order._quantity; if (checkedproduct == null) { ProductTransactions.Add(product, price * quantity); } else { ProductTransactions[checkedproduct] += price * quantity; } }
public void BuySnack(int i) { Console.Clear(); i--; ISellable snack = _store.Merchandise[i]; if (snack.Price > _store.Balance) { Console.WriteLine($"You don't have enough quarters for that! Machine balance: ${_store.Balance}"); } else { snack.Stock--; _store.Balance -= snack.Price; Console.WriteLine($"You purchased {snack.Name} for ${snack.Price}. You now have ${_store.Balance}"); } }
static void Main(string[] args) { // // OLD MACDONALD // Cow sleepy = new Cow("Sleepy"); sleepy.Sleep(); Cat cat = new Cat("Cosmic Creepers"); cat.Sleep(); Jersey jersey = new Jersey(); Cat felix = new Cat("Felix"); Console.WriteLine(sleepy.Eat()); Console.WriteLine(cat.Eat()); ISingable[] singables = new ISingable[] { new Cow("Henry"), new Chicken(), new Pig(), new Tractor(), new Cow("Earl"), sleepy, cat, jersey, felix }; ((FarmAnimal)singables[2]).Sleep(); foreach (ISingable singable in singables) { Console.WriteLine("Old MacDonald had a farm, ee ay ee ay oh!"); Console.WriteLine("And on his farm he had a " + singable.Name + ", ee ay ee ay oh!"); Console.WriteLine("With a " + singable.Sound + " " + singable.Sound + " here"); Console.WriteLine("And a " + singable.Sound + " " + singable.Sound + " there"); Console.WriteLine("Here a " + singable.Sound + " there a " + singable.Sound + " everywhere a " + singable.Sound + " " + singable.Sound); Console.WriteLine(); } ISellable[] sellables = new ISellable[] { new Cow("Henry"), new Pig(), new Egg() }; foreach (ISellable sellable in sellables) { Console.WriteLine("Step right up and get your " + sellable.Name); Console.WriteLine("Only $" + sellable.Price); } }
public string DrawMerch() { string template = ""; List <ISellable> snacks = _store.Merchandise; for (int i = 0; i < _store.Merchandise.Count; i++) { ISellable snack = _store.Merchandise[i]; if (snack.Stock < 1) { template += $"{i + 1}. Out of Stock\n"; } else { template += $"{i + 1}: {snack.Name}({snack.Brand}): ${snack.Price}\n"; } } return(template); }
private bool CanBeBought(ISellable item) { if (item == EMPTY) { return(false); } //item in gear of player bool itemInGear = false; if (item is Gun) { if (playerGear[((int)((Gun)item).tier)] != EMPTY) { itemInGear = true; } } if (itemInGear) { for (int i = 0; i < playerGear.Length; i++) { if (playerGear[i] == EMPTY) { continue; } if (((Entity)playerGear[i]).name == ((Entity)item).name) { itemInGear = true; } } } return(customer.cash >= item.cashValue && itemInGear == false); }
public void AddProduct(ISellable product) { this.Producten.Add(product); }
public Order(ISellable product, int quantity) { _product = (Product)product; _quantity = quantity; }
public FrmOrderDetailManager(Dictionary <string, object> dataSender, ISellable sellBuss) { this.sellBuss = sellBuss; this.dataSender = dataSender; InitializeComponent(); }
public void DisplayBestproduct() { ISellable bestproduct = GetBestproduct(); Console.WriteLine($"Best product is {bestproduct} which has made {ProductTransactions[bestproduct]} dollars."); }
public override void Update(GameTime gameTime) { KeyboardState keyState = Keyboard.GetState(); if (timer == 0) { if (keyState.IsKeyDown(Keys.Left) || keyState.IsKeyDown(Keys.Right) || keyState.IsKeyDown(Keys.Up) || keyState.IsKeyDown(Keys.Down)) { timer = 100; } if (keyState.IsKeyDown(Keys.Left)) { if (mainCurrentOption == 0) { mainCurrentOption = menu.Length - 1; } else { mainCurrentOption--; } listCurrentOption = 0; } else if (keyState.IsKeyDown(Keys.Right)) { if (mainCurrentOption == menu.Length - 1) { mainCurrentOption = 0; } else { mainCurrentOption++; } listCurrentOption = 0; } else if (keyState.IsKeyDown(Keys.Up)) { if (listCurrentOption == 0) { listCurrentOption = lists[mainCurrentOption].Length - 1; } else { listCurrentOption--; } } else if (keyState.IsKeyDown(Keys.Down)) { if (listCurrentOption == lists[mainCurrentOption].Length - 1) { listCurrentOption = 0; } else { listCurrentOption++; } } else if (keyState.IsKeyDown(Keys.Enter)) { DoAction(); } currentItem = GetCurrentItem(); if (currentItem == EMPTY) { action = Action.Nothing; actionText = ""; } else if (mainCurrentOption == 0) { action = Action.Sell; actionText = "Sell: " + currentItem.cashValue / 2 + "$"; } else { action = Action.Buy; actionText = "Buy: " + currentItem.cashValue + "$"; } } else { timer -= gameTime.ElapsedGameTime.Milliseconds; if (timer < 0) { timer = 0; } if (keyState.IsKeyUp(Keys.Left) && keyState.IsKeyUp(Keys.Right) && keyState.IsKeyUp(Keys.Up) && keyState.IsKeyUp(Keys.Down)) { timer = 0; } } }
public Transaction(ISellable sellable, int quantity, Client client) { _product = sellable; _order = new Order(_product, quantity); _client = client; }
public void SetCustomer(Player customer) { this.customer = customer; RefreshMenu(); currentItem = GetCurrentItem(); }
public bool IsSameModel(ISellable anotherItem) { //Т.к. сборки продаются по отдельнсти return(false); }
public int GetSellPrice(ISellable sellable) { return(base.GetValueForType(sellable.GetType())); }