Ejemplo n.º 1
0
        /// <summary>
        /// Called to instantiate an inventory prototype cell to be added to the inventory cell list.
        /// </summary>
        public void CreateInventoryCell(GameObject cellPrefab, List <GameObject> inventoryCells)
        {
            foreach (WeaponInfo info in weaponServicer.GetHangarWeapons())
            {
                if (!info.isAttached)
                {
                    GameObject spawnedInstance = Instantiate(cellPrefab, contentView.transform);

                    IInventoryCell cellInterface = spawnedInstance.GetComponent <IInventoryCell>();
                    cellInterface.InitialiseCell(info);
                    cellInterface.PassInterfaces(infoPanel);
                    cellInterface.SetColor(GetWeaponCellColor(info.weaponType));

                    IUICellChecker equipmentInterface = spawnedInstance.GetComponent <IUICellChecker>();
                    equipmentInterface.SetCell(slotChecker, assigner, false);

                    inventoryCells.Add(spawnedInstance);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Called to instantiate an equipment cell using the specified prefab.
        /// </summary>
        public void SpawnEquipmentCell(string identifier, GameObject cellPrefab, List <GameObject> inventoryCells)
        {
            if (identifier == "")
            {
                GameObject emptyCell       = GameManager.Instance.uiSettings.emptyListCell;
                GameObject spawnedInstance = Instantiate(emptyCell, contentView.transform);
                inventoryCells.Add(spawnedInstance);
            }
            else
            {
                WeaponInfo info            = weaponServicer.GetWeaponItem(identifier);
                GameObject spawnedInstance = Instantiate(cellPrefab, contentView.transform);

                IInventoryCell cellInterface = spawnedInstance.GetComponent <IInventoryCell>();
                cellInterface.InitialiseCell(info);
                cellInterface.PassInterfaces(infoPanel);
                //cellInterface.SetColor(GetWeaponCellColor(equipmentMenu.GetCurrentType())); DOES NOT WORK UNTIL EQUIPMENT TYPES ARE CONSIDERED.

                IUICellChecker equipmentInterface = spawnedInstance.GetComponent <IUICellChecker>();
                equipmentInterface.SetCell(slotChecker, assigner, true);

                inventoryCells.Add(spawnedInstance);
            }
        }