//todo: use events private void TradeSuccess() { if (ShakeDown) { Buyer.Attitude += CurrentArt.Value; CurrentComment = "I knew you would understand."; } else { Buyer.Attitude++; CurrentComment = "That's a deal!"; } Player.ArtWorks.Remove(CurrentArt); SelectionWheel.DestroySaleObject(); Player.Food += CurrentOffer.GetFoodValue(); Player.Security += CurrentOffer.GetSecurityValue(); //TODO: remove items from inventory Debug.Log($"You just sold {CurrentArt} for {CurrentOffer.AsText()}!"); CurrentTradeState = TradeState.Success; OnUpdate.Invoke(); }
private void StartTrade() { int artAptitude = 0; if (CurrentArt.Colors.Contains(WantedColor)) { artAptitude++; } if (CurrentArt.Properties.Contains(WantedProperty)) { artAptitude++; } CurrentOffer = Buyer.Inventory.GetResourcesOfValue(Random.Range(CurrentArt.Value / 5, CurrentArt.Value + Patience)); switch (artAptitude) { case 0: Patience = Buyer.Attitude / 2; CurrentComment = $"That's not really what I wanted. I can give you <b>{CurrentOffer.AsText()}</b>"; break; case 1: Patience = Buyer.Attitude; CurrentComment = $"Alright. I can give you <b>{CurrentOffer.AsText()}</b> for that"; break; case 2: Patience = Buyer.Attitude + 5; CurrentComment = $"That's perfect! I will give you <b>{CurrentOffer.AsText()}</b>"; break; } CurrentTradeState = TradeState.Negotiating; OnUpdate.Invoke(); }