public virtual void UnUseWithTrigger() { // In case someone would like to use it with a trigger and without. // Need a new object, otherwise progress would be stored in the last used trigger. progressContainer = new CraftingProgressContainer(this, GetInstanceID(), GetComponent <AudioSource>()); overrideRemoveItemsFromCollection = null; overrideStoreRewardItemsInCollection = null; window.Hide(); }
protected virtual void Awake() { currentCategory = startCraftingCategory; progressContainer = new CraftingProgressContainer(this, GetInstanceID(), GetComponent <AudioSource>()); window.OnShow += OnWindowShown; window.OnHide += OnWindowHidden; blueprintCraftButton.onClick.AddListener(OnCraftButtonClicked); PlayerManager.instance.OnPlayerChanged += InstanceOnPlayerChanged; if (PlayerManager.instance.currentPlayer != null) { InstanceOnPlayerChanged(null, PlayerManager.instance.currentPlayer); } }
public virtual void UseWithTrigger(CraftingCategory category, CraftingProgressContainer progressContainer, ICraftingActionValidator validator, ItemCollectionBase removeItemsFromCollection, ItemCollectionBase storeRewardItemsInCollection) { Assert.IsNotNull(category); Assert.IsNotNull(progressContainer); overrideRemoveItemsFromCollection = removeItemsFromCollection; overrideStoreRewardItemsInCollection = storeRewardItemsInCollection; if (_forceSingleInstance) { this.progressContainer = new CraftingProgressContainer(this, GetInstanceID(), GetComponent <AudioSource>()); } else { this.progressContainer = progressContainer; this.progressContainer.validator = validator; } SetCraftingCategory(category); window.Show(); }