/// <summary>
        /// Called by window event.
        /// From an external call use the triggerer. UnUse() instead.
        /// </summary>
        protected virtual void CloseTreasureChest()
        {
            open = false;
            if (lastChest == this)
            {
                lastChest = null;
            }

            triggerer.UnUse(); // Bit of a special case

            window.OnHide            -= window_OnHide;
            lootWindow.OnRemovedItem -= lootWindow_OnRemovedItem;
        }
        /// <summary>
        /// Open this treasure chest, auto. closes the previous one.
        /// From an external call use the triggerer. Use() instead.
        /// </summary>
        protected virtual void OpenTreasureChest()
        {
            if (this != lastChest && lastChest != null)
            {
                lastChest.CloseTreasureChest();
            }

            lastChest = this;

            // Set items
            lootWindow.SetItems(items, true);
            window.OnHide            += window_OnHide;
            lootWindow.OnRemovedItem += lootWindow_OnRemovedItem;

            if (open == false)
            {
                window.Show();
                open = true;
            }
        }
 public override void OnReset()
 {
     items = null;
     chest = null;
 }
 public override void OnReset()
 {
     chest = null;
     open = false;
 }
        /// <summary>
        /// Called by window event.
        /// From an external call use the triggerer. UnUse() instead.
        /// </summary>
        protected virtual void CloseTreasureChest()
        {
            open = false;
            if (lastChest == this)
                lastChest = null;

            triggerer.UnUse(); // Bit of a special case

            window.OnHide -= window_OnHide;
            lootWindow.OnRemovedItem -= lootWindow_OnRemovedItem;
        }
        /// <summary>
        /// Open this treasure chest, auto. closes the previous one.
        /// From an external call use the triggerer. Use() instead.
        /// </summary>
        protected virtual void OpenTreasureChest()
        {
            if (this != lastChest && lastChest != null)
                lastChest.CloseTreasureChest();

            lastChest = this;

            // Set items
            lootWindow.SetItems(items, true);
            window.OnHide += window_OnHide;
            lootWindow.OnRemovedItem += lootWindow_OnRemovedItem;

            if (open == false)
            {
                window.Show();
                open = true;
            }
        }
 public override void OnReset()
 {
     chest = null;
 }