public IEnumerator Trading(ItemCollector item, DropStockArea stock) { while (trading) { yield return(new WaitForEndOfFrame()); } Debug.Log("Trade " + item.Item.ItemName + " to " + number); stock.Trade(number); Cancel(); }
public void StartTrade(ItemCollector item, DropStockArea stock) { if (item == null || stock == null || Number == null) { return; } Number.text = item.Num.ToString(); trading = true; this.gameObject.SetActive(true); StartCoroutine(Trading(item, stock)); }
void Start() { dropArea = this.GetComponent <DropStockArea>(); }