private void SetShowedItems(ItemData[] itemDatas) { closeObtained = false; this.itemDatas = itemDatas; currentShowedItemIndex = 0; BoxItemPresenter.SetRemaingValue(itemDatas.Length); }
public void OpenBox(Box box) //UnityEventCall { if (CheckPossibleOpenBox(box)) { TakeCostFromBox(box); ItemsInBox = Random.Range(box.MinItems, box.MaxItems); BoxItemPresenter.ShowBox(box); SetShowedItems(GetItemsFromBox(box.Items)); PlayerDataModel.AddXp(box.XP); } else { ShowNotEnoughWindow(box); } }
private void NextItem() { if (closeObtained) { BoxItemPresenter.HideObtained(); return; } if (currentShowedItemIndex > itemDatas.Length - 1) { BoxItemPresenter.ShowObtained(); closeObtained = true; } else { ItemDistributor.AddItem(itemDatas[currentShowedItemIndex]); } currentShowedItemIndex++; BoxItemPresenter.SetRemaingValue(itemDatas.Length - currentShowedItemIndex); }
private void Awake() { instance = this; //graphController = FindObjectOfType<GraphController>(); }
private void Start() { BoxItemPresenter.OnClickNextSubscribe(() => NextItem()); }