public SpriteRect AnimLoad(game_item item, int _layer) { Transform child = Instantiate(SpriteContainer).transform; child.name = "weapon_anim_walk"; SpriteRect sr = child.gameObject.AddComponent <SpriteRect>(); child.SetParent(transform); child.localPosition = Vector3.zero; child.localEulerAngles = Vector3.zero; child.localScale = new Vector3(1, 1, 1); sr.LoadSprites(item.id_sprite, _layer); sr.in_layer = _layer; sr.color = new Color(1, 1, 1, 0); return(sr); }
public void AddItem(game_item item) { try { SpriteRect sr; if (item.type == item_type.wand || item.type == item_type.spears || item.type == item_type.bow || item.type == item_type.melee_weapons) { sr = Wearable_items[item_type.melee_weapons]; if (item.type == item_type.melee_weapons) { sr.in_layer = hair_l + 3; weapon_anim.color = Color.white; } else { sr.in_layer = hair_l + 1; weapon_anim.color = new Color(1, 1, 1, 0); } } else { sr = Wearable_items[item.type]; } sr.LoadSprites(item.id_sprite, sr.in_layer); sr.color = item.rarity.color; } catch { Transform child = Instantiate(SpriteContainer).transform; if (item.type == item_type.wand || item.type == item_type.melee_weapons || item.type == item_type.spears || item.type == item_type.bow) { child.name = "(weapon slot)"; } else { child.name = item.type.ToString(); } SpriteRect sr = child.gameObject.AddComponent <SpriteRect>(); child.SetParent(transform); child.localPosition = Vector3.zero; child.localEulerAngles = Vector3.zero; child.localScale = new Vector3(1, 1, 1); sr.LoadSprites(item.id_sprite, layers); sr.in_layer = layer; sr.color = item.rarity.color; layers++; if (item.type == item_type.wand || item.type == item_type.spears) { Wearable_items.Add(item_type.melee_weapons, sr); } else { Wearable_items.Add(item.type, sr); } } }