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 virtual void Awake()
        {
            //base.Awake();
            lootWindow       = InventoryManager.instance.loot;
            window           = lootWindow.window;
            triggerer        = GetComponent <ObjectTriggerer>();
            triggerer.window = window;
            triggerer.handleWindowDirectly = false; // We're in charge now :)

            animator = GetComponent <Animator>();


            triggerer.OnTriggerUse += () =>
            {
                OpenTreasureChest();
            };
            triggerer.OnTriggerUnUse += () =>
            {
                if (open)
                {
                    window.Hide();

                    open = false;
                }
            };


            CreateGenerator();
        }
Ejemplo n.º 3
0
        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()
        {
            vendorUI         = InventoryManager.instance.vendor;
            animator         = GetComponent <Animator>();
            triggerer        = GetComponent <ObjectTriggerer>();
            triggerer.window = vendorUI.window;
            triggerer.handleWindowDirectly = false; // We're in charge now :)

            buyBackParent = new GameObject("Vendor_BuyBackContainer").transform;
            buyBackParent.SetParent(InventoryManager.instance.collectionObjectsParent);

            CreateGenerator();


            triggerer.OnTriggerUse += () =>
            {
                // Set items
                vendorUI.SetItems(forSale, false);
                vendorUI.currentVendor  = this;
                vendorUI.OnRemovedItem += vendorUI_OnRemovedItem;

                if (vendorUI.window.isVisible == false)
                {
                    vendorUI.window.Show();
                }
            };
            triggerer.OnTriggerUnUse += () =>
            {
                vendorUI.window.Hide();
                vendorUI.currentVendor  = null;
                vendorUI.OnRemovedItem -= vendorUI_OnRemovedItem;
            };
        }
        public virtual void Awake()
        {
            //base.Awake();
            lootWindow = InventoryManager.instance.loot;
            window = lootWindow.window;
            triggerer = GetComponent<ObjectTriggerer>();
            triggerer.window = window;
            triggerer.handleWindowDirectly = false; // We're in charge now :)

            animator = GetComponent<Animator>();

            triggerer.OnTriggerUse += () =>
            {
                OpenTreasureChest();
            };
            triggerer.OnTriggerUnUse += () =>
            {
                if (open)
                {
                    window.Hide();

                    open = false;
                }
            };

            CreateGenerator();
        }
Ejemplo n.º 6
0
        public virtual void Awake()
        {
            //base.Awake();
            lootWindow = InventoryManager.instance.loot;
            if (lootWindow == null)
            {
                Debug.LogWarning("No loot window set, yet there's a lootable object in the scene", transform);
                return;
            }

            window = lootWindow.window;
            triggerer = GetComponent<ObjectTriggerer>();
            triggerer.window = window;
            triggerer.handleWindowDirectly = false; // We're in charge now :)

            animator = GetComponent<Animator>();

            triggerer.OnTriggerUse += Use;
            triggerer.OnTriggerUnUse += UnUse;
        }
        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();
            };
        }
        public void Awake()
        {
            vendorUI = InventoryManager.instance.vendor;
            animator = GetComponent<Animator>();
            triggerer = GetComponent<ObjectTriggerer>();
            triggerer.window = vendorUI.window;
            triggerer.handleWindowDirectly = false; // We're in charge now :)

            buyBackParent = new GameObject("Vendor_BuyBackContainer").transform;
            buyBackParent.SetParent(InventoryManager.instance.collectionObjectsParent);

            CreateGenerator();

            triggerer.OnTriggerUse += () =>
            {
                // Set items
                vendorUI.SetItems(forSale, false);
                vendorUI.currentVendor = this;
                vendorUI.OnRemovedItem += vendorUI_OnRemovedItem;

                if (vendorUI.window.isVisible == false)
                {
                    vendorUI.window.Show();
                }
            };
            triggerer.OnTriggerUnUse += () =>
            {
                vendorUI.window.Hide();
                vendorUI.currentVendor = null;
                vendorUI.OnRemovedItem -= vendorUI_OnRemovedItem;
            };
        }
Ejemplo n.º 9
0
        public void Awake()
        {
            vendorUI = InventoryManager.instance.vendor;
            if (vendorUI == null)
            {
                Debug.LogWarning("No vendor UI found, yet there's a vendor in the scene.", transform);
                return;
            }

            animator = GetComponent<Animator>();
            triggerer = GetComponent<ObjectTriggerer>();
            triggerer.window = vendorUI.window;
            triggerer.handleWindowDirectly = false; // We're in charge now :)

            buyBackDict = new Dictionary<string, List<InventoryItemBase>>();

            buyBackParent = new GameObject("Vendor_BuyBackContainer").transform;
            buyBackParent.SetParent(InventoryManager.instance.collectionObjectsParent);


            triggerer.OnTriggerUse += Use;
            triggerer.OnTriggerUnUse += UnUse;
        }
Ejemplo n.º 10
0
        public override bool UnUse(InventoryPlayer player, bool fireEvents = true)
        {
            if (enabled == false || inRange == false)
                return false;

            if (isActive == false)
                return true;

            if (handleWindowDirectly && fireEvents && window != null)
            {
                window.Hide();
            }

            UndoVisuals();


            isActive = false;

            if (window != null)
            {
                window.OnShow -= WindowOnShow;
                window.OnHide -= WindowOnHide;
            }

            if (OnTriggerUnUse != null && fireEvents)
                OnTriggerUnUse(player);

            InventoryTriggererManager.instance.NotifyTriggererUnUsed(this);

            previousTriggerer = null;
            return true;
        }
Ejemplo n.º 11
0
        public override bool Use(InventoryPlayer player, out bool removeSource, bool fireEvents = true)
        {
            removeSource = false; // ObjectTriggers are "static" and aren't moved / changed after usage.

            if (enabled == false || inRange == false)
                return false;

            if (isActive)
                return true;

            if (previousTriggerer != null)
            {
                previousTriggerer.UnUse(player, fireEvents);
            }

            if (window != null)
            {
                window.OnShow += WindowOnShow;
                window.OnHide += WindowOnHide;

                if (handleWindowDirectly && fireEvents)
                {
                    if (toggleWhenTriggered)
                        window.Toggle();
                    else if (window.isVisible == false)
                        window.Show();
                }
            }
            else
            {
                Debug.LogWarning("Triggerer has no window", transform);
            }

            DoVisuals();

            isActive = true;

            if (OnTriggerUse != null && fireEvents)
                OnTriggerUse(player);

            InventoryTriggererManager.instance.NotifyTriggererUsed(this);
            previousTriggerer = this;

            return true;
        }