public void Awake() { window = InventoryManager.instance.craftingStandard.window; triggerer = GetComponent<ObjectTriggerer>(); triggerer.window = window; triggerer.handleWindowDirectly = false; // We're in charge now :) window.OnHide += () => { currentCraftingStation = null; }; triggerer.OnTriggerUse += () => { window.Toggle(); if (window.isVisible) { currentCraftingStation = this; InventoryManager.instance.craftingStandard.SetCraftingCategory(category); } }; triggerer.OnTriggerUnUse += () => { if (currentCraftingStation == this) window.Hide(); }; }
public void Awake() { window = InventoryManager.instance.craftingStandard.window; triggerer = GetComponent <ObjectTriggerer>(); triggerer.window = window; triggerer.handleWindowDirectly = false; // We're in charge now :) window.OnHide += () => { currentCraftingStation = null; }; triggerer.OnTriggerUse += () => { window.Toggle(); if (window.isVisible) { currentCraftingStation = this; InventoryManager.instance.craftingStandard.SetCraftingCategory(category); } }; triggerer.OnTriggerUnUse += () => { if (currentCraftingStation == this) { window.Hide(); } }; }
public void Awake() { if (InventoryManager.instance.craftingStandard == null) { Debug.LogWarning("Crafting triggerer in scene, but no crafting window found", transform); return; } window = InventoryManager.instance.craftingStandard.window; triggerer = GetComponent<ObjectTriggerer>(); triggerer.window = window; triggerer.handleWindowDirectly = false; // We're in charge now :) if (triggerer.window == null) { Debug.LogWarning("Crafting triggerer created but no CraftingStandardUI found in scene, or not set in managers.", transform); return; } window.OnHide += () => { currentCraftingStation = null; }; triggerer.OnTriggerUse += (player) => { window.Toggle(); if (window.isVisible) { currentCraftingStation = this; InventoryManager.instance.craftingStandard.SetCraftingCategory(category); } }; triggerer.OnTriggerUnUse += (player) => { if (currentCraftingStation == this) window.Hide(); }; }