Exemplo n.º 1
0
        private void createSpriteForItem(EcsEntity entity)
        {
            ItemComponent       item           = entity.Get <ItemComponent>();
            ItemVisualComponent visual         = new ItemVisualComponent();
            Vector3             spritePosition = ViewUtil.fromModelToScene(entity.pos());

            visual.go = Object.Instantiate(itemPrefab, spritePosition + new Vector3(0, 0, -0.1f), Quaternion.identity);
            visual.go.transform.SetParent(GameView.get().mapHolder);
            visual.spriteRenderer        = visual.go.GetComponent <SpriteRenderer>();
            visual.spriteRenderer.sprite = createSprite(ItemTypeMap.getItemType(item.type));
            entity.Replace(visual);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Get the stash page where items should ideally be placed, ignoring if it can actually be placed there.
 /// </summary>
 public static int GetIdealStashPage(TrinityItem item)
 {
     if (item.IsEquipment && Core.Settings.Items.UseTypeStashingEquipment && ItemTypeMap.ContainsKey(item.RawItemType))
     {
         return(ItemTypeMap[item.RawItemType]);
     }
     else if (Core.Settings.Items.UseTypeStashingOther && ItemTypeMap.ContainsKey(item.RawItemType))
     {
         return(ItemTypeMap[item.RawItemType]);
     }
     if (item.ItemBaseType >= ItemBaseType.Misc)
     {
         return(TotalStashPages - 1);
     }
     return(-1);
 }
Exemplo n.º 3
0
        public EcsEntity generateItem(string typeName, string materialName, Vector3Int position, EcsEntity entity)
        {
            ItemType type = ItemTypeMap.getItemType(typeName);

            if (type == null)
            {
                Debug.LogError("Type " + typeName + " not found.");
            }
            Material_ material = MaterialMap.get().material(materialName);

            entity.Replace(new ItemComponent {
                material = material.id, type = typeName, materialString = material.name, volume = 1, weight = material.density * 1
            });
            entity.Replace(new PositionComponent {
                position = position
            });
            entity.Replace(new NameComponent());
            // entity.Replace(new ItemVisualComponent());
            return(entity);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Get the stash page where items should ideally be placed, ignoring if it can actually be placed there.
        /// </summary>
        public static int GetIdealStashPage(ACDItem item)
        {
            if (item.GetIsEquipment() &&
                Core.Settings.Items.UseTypeStashingEquipment &&
                ItemTypeMap.ContainsKey(item.GetRawItemType()))
            {
                return(ItemTypeMap[item.GetRawItemType()]);
            }

            if (Core.Settings.Items.UseTypeStashingOther &&
                ItemTypeMap.ContainsKey(item.GetRawItemType()))
            {
                return(ItemTypeMap[item.GetRawItemType()]);
            }

            if (item.ItemBaseType >= ItemBaseType.Misc)
            {
                return(TotalStashPages - 1);
            }

            return(-1);
        }
Exemplo n.º 5
0
        public ItemType processExtendedType(RawItemType rawType, string namePrefix)
        {
            ItemType baseType = ItemTypeMap.getItemType(rawType.baseItem); // get base type

            return(addAspectsFromRawType(new ItemType(baseType, rawType, namePrefix), rawType));
        }