コード例 #1
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));
                }
            }
        }
コード例 #2
0
        public void SetSpacing()
        {
            Vector3 rectPosition = equipmentPoolManager.transform.position;

            equipmentPoolManager.transform.GetChild(0).GetComponent <ItemIconScript>().SetLastPosition(rectPosition);
            equipmentPoolManager.transform.GetChild(1).GetComponent <ItemIconScript>().SetLastPosition(rectPosition + (weaponSpacing * 1));
            equipmentPoolManager.transform.GetChild(2).GetComponent <ItemIconScript>().SetLastPosition(rectPosition + (weaponSpacing * 2));
            equipmentPoolManager.transform.GetChild(3).GetComponent <ItemIconScript>().SetLastPosition(rectPosition + (weaponSpacing * 3));
            equipmentPoolManager.transform.GetChild(4).GetComponent <ItemIconScript>().SetLastPosition(rectPosition + (weaponSpacing * 3) + sheildSpacing);

            for (int i = 0; i < inventoryPoolManager.transform.childCount; i++)
            {
                ItemIconScript obj = inventoryPoolManager.transform.GetChild(i).gameObject.GetComponent <ItemIconScript>();
                obj.SetLastPosition(inventoryPoolManager.GetComponent <RectTransform>().position + (inventorySpacing * i));
            }
        }