private void FillInventory(bool creative)
 {
     if (creative)
     {
         for (int i = 0; i < inventSpots.Length; i++)
         {
             inventSpots[i] = new InventorySpot();
             if (creative)
             {
                 inventSpots[i].blockType = (byte)(i);
             }
         }
     }
     else
     {
         for (int i = 0; i < inventSpots.Length; i++)
         {
             inventSpots[i] = new InventorySpot();
             if (creative)
             {
                 inventSpots[i].blockType = (byte)(0);
             }
         }
     }
 }
 // Start is called before the first frame update
 void Start()
 {
     currentLegendVisibility = false;
     inventArrayLocation     = 0;
     zeroAlpha.a             = 0;
     fullAlpha.a             = 1;
     inventSpots             = new InventorySpot[8];
     FillInventory(creative);
     UpdateInventory();
     currentlySelectedInventorySpot = inventSpots[inventArrayLocation];
 }
 public void DecrementSelectedInventorySpot()
 {
     if (inventArrayLocation == 0)
     {
         inventorySpot.transform.Translate(700, 0, 0);
         inventArrayLocation            = inventSpots.Length - 1;
         currentlySelectedInventorySpot = inventSpots[inventArrayLocation];
     }
     else
     {
         inventorySpot.transform.Translate(-100, 0, 0);
         inventArrayLocation--;
         currentlySelectedInventorySpot = inventSpots[inventArrayLocation];
     }
 }
 public void IncrementSelectedInventorySpot()
 {
     if (inventArrayLocation == inventSpots.Length - 1)
     {
         inventorySpot.transform.Translate(-700, 0, 0);
         inventArrayLocation            = 0;
         currentlySelectedInventorySpot = inventSpots[inventArrayLocation];
     }
     else
     {
         inventorySpot.transform.Translate(100, 0, 0);
         inventArrayLocation++;
         currentlySelectedInventorySpot = inventSpots[inventArrayLocation];
     }
 }
    public void AddItem(InventoryObject item)
    {
        var slot = GetInventorySlot(item);

        if (slot == null)
        {
            slot = new InventorySpot()
            {
                Count = 0, ItemType = item
            };
            Items.Add(slot);
        }
        slot.Count++;
        if (ItemAdded != null)
        {
            ItemAdded(this, EventArgs.Empty);
        }
    }
        public Item GetItem(InventorySpot spot)
        {
            switch (spot)
            {
            case InventorySpot.Head:
                return(head);

            case InventorySpot.LHand:
                return(leftHand);

            case InventorySpot.RHand:
                return(rightHand);

            case InventorySpot.Body:
                return(body);

            case InventorySpot.Feet:
                return(feet);

            default:
                return(null);
            }
        }
        public bool IsSlotEquipped(InventorySpot spot)
        {
            switch (spot)
            {
            case InventorySpot.Head:
                return(head != null);

            case InventorySpot.LHand:
                return(leftHand != null);

            case InventorySpot.RHand:
                return(rightHand != null);

            case InventorySpot.Body:
                return(body != null);

            case InventorySpot.Feet:
                return(feet != null);

            default:
                return(false);
            }
        }