void Start() { button = GetComponent <Button>(); mysteryBoxInventory = FindObjectOfType <MysteryBoxInventory>(); button.interactable = mysteryBoxInventory.Owned > 0; EventBroker.Instance().SubscribeMessage <EventMysteryBoxBought>(ShouldBeActive); }
IEnumerator Start() { yield return(new WaitForSeconds(3f)); mysteryBoxInventory = FindObjectOfType <MysteryBoxInventory>(); var amount = mysteryBoxInventory.Owned; amountText.text = amount > 0 ? $"{amount}" : " "; EventBroker.Instance().SubscribeMessage <EventMysteryBoxBought>(OnLootBoxPurchased); EventBroker.Instance().SubscribeMessage <EventMysteryBoxOpened>(OnLootBoxOpened); }