public void AddBag(Bag bag, int bagIndex)
 {
     bag.SetupScript();
     MyBags.Add(bag);
     bag.MyBagButton            = bagButtons[bagIndex];
     bagButtons[bagIndex].MyBag = bag;
 }
    public void OpenClose()
    {
        bool closedBag = MyBags.Find(x => !x.MyBagScript.IsOpen);

        foreach (Bag bag in MyBags)
        {
            if (bag.MyBagScript.IsOpen != closedBag)
            {
                bag.MyBagScript.OpenClose();
            }
        }
    }
 public void AddBag(Bag bag)
 {
     foreach (BagButton bagButton in bagButtons)
     {
         if (bagButton.MyBag == null)
         {
             bagButton.MyBag = bag;
             MyBags.Add(bag);
             bag.MyBagButton = bagButton;
             bag.MyBagScript.transform.SetSiblingIndex(bagButton.MyBagIndex);
             break;
         }
     }
 }
 public void RemoveBag(Bag bag)
 {
     MyBags.Remove(bag);
     Destroy(bag.MyBagScript.gameObject);
 }
 public void AddBag(Bag bag, BagButton bagButton)
 {
     MyBags.Add(bag);
     bagButton.MyBag = bag;
     bag.MyBagScript.transform.SetSiblingIndex(bagButton.MyBagIndex);
 }