private void SetStats(ItemDefinition itemDefinition) { List <StatModifier> modifiers = null; if (itemDefinition.GetType() == typeof(WeaponDefinition)) { modifiers = ((WeaponDefinition)itemDefinition).Stats; } if (itemDefinition.GetType() == typeof(ArmorDefinition)) { modifiers = ((ArmorDefinition)itemDefinition).Stats; } if (modifiers != null) { foreach (var modifier in modifiers) { m_contentLabel.text += modifier.ToString() + "\n"; } m_contentLabel.text += "\n"; } }
public static string ReadableType(this ItemDefinition definition) { var itemType = definition.GetType().Name; return(itemType.Remove(itemType.Length - "Definition".Length, "Definition".Length)); }