コード例 #1
0
        void UpdateUI()
        {
            equipmentPoolManager.transform.GetChild(0).GetComponent <ItemIconScript>().StoreItem(_playerInventory.GetWeaponFromHolster(0));
            equipmentPoolManager.transform.GetChild(1).GetComponent <ItemIconScript>().StoreItem(_playerInventory.GetWeaponFromHolster(1));
            equipmentPoolManager.transform.GetChild(2).GetComponent <ItemIconScript>().StoreItem(_playerInventory.GetWeaponFromHolster(2));
            equipmentPoolManager.transform.GetChild(3).GetComponent <ItemIconScript>().StoreItem(_playerInventory.GetWeaponFromHolster(3));
            equipmentPoolManager.transform.GetChild(4).GetComponent <ItemIconScript>().StoreItem(_playerInventory.GetCurrentSheild());

            equipmentPoolManager.transform.GetChild(0).GetComponent <ItemIconScript>().emptyText = "WEAPON SLOT 1";
            equipmentPoolManager.transform.GetChild(1).GetComponent <ItemIconScript>().emptyText = "WEAPON SLOT 2";
            equipmentPoolManager.transform.GetChild(2).GetComponent <ItemIconScript>().emptyText = "WEAPON SLOT 3";
            equipmentPoolManager.transform.GetChild(3).GetComponent <ItemIconScript>().emptyText = "WEAPON SLOT 4";
            equipmentPoolManager.transform.GetChild(4).GetComponent <ItemIconScript>().emptyText = "SHEILD SLOT";


            for (int i = 0; i < inventoryPoolManager.transform.childCount; i++)
            {
                ItemIconScript icon = inventoryPoolManager.transform.GetChild(i).GetComponent <ItemIconScript>();
                icon.StoreItem(null);
                icon.emptyText = "NONE";
            }

            iconCount = 0;

            SetItemsIntoIcons(_playerInventory.weaponsInventoryObj);

            SetItemsIntoIcons(_playerInventory.sheildInventoryObj);

            SetItemsIntoIcons(_playerInventory.weaponModInventoryObj);

            SetItemsIntoIcons(_playerInventory.sheildModInventoryObj);

            SetItemsIntoIcons(_playerInventory.itemInventoryObj);
        }
コード例 #2
0
        void SetItemsIntoIcons(GameObject inventory)
        {
            for (int i = 0; i < inventory.transform.childCount; i++)
            {
                Item           item = inventory.transform.GetChild(i).GetComponent <Item>();
                ItemIconScript icon = inventoryPoolManager.transform.GetChild(iconCount).GetComponent <ItemIconScript>();

                icon.StoreItem(item);
                iconCount++;
            }
        }
コード例 #3
0
        void UpdateInspectionUI()
        {
            Item item = referenceToOriginalIcon.GetItem();

            if (item == null)
            {
                return;
            }
            Vector3 centerPosition = inspectionPoolManager.transform.position;


            itemBeingInspectedIcon.SetLastPosition(centerPosition);
            itemBeingInspectedIcon.StoreItem(item);

            for (int i = 2; i < inspectionPoolManager.transform.childCount; i++)
            {
                ItemIconScript modIcon = inspectionPoolManager.transform.GetChild(i).GetComponent <ItemIconScript>();
                modIcon.StoreItem(null);
                int slotNum = i - 2;
                if (slotNum < item.numOfModSlots)
                {
                    ModBase mod = item.itemMods[slotNum];
                    if (mod != null)
                    {
                        modIcon.StoreItem(mod);
                    }
                    else
                    {
                        modIcon.emptyText = "Mod Component " + (slotNum + 1);
                    }

                    Vector3 dirToNewPos    = Quaternion.Euler(0, 0, 360.0f * ((float)slotNum / (float)item.numOfModSlots)) * (Vector3.up * 75);
                    Vector3 positionOffset = new Vector3(0, -15, 0);
                    modIcon.SetLastPosition(centerPosition + positionOffset + dirToNewPos);
                }
                else
                {
                    modIcon.SetLastPosition(new Vector3(0, 9999, 0));
                }
            }
        }