#SO usage with items
1 messages · Page 1 of 1 (latest)
If you are referring to the second approach where you manually define all data.
The tier would simply be another SO that holds the base ItemSO
Then if you wanted mutable information, you would instance it into a struct.
[CreateAssetMenu]
public class ItemTierDefinition: ScriptableObject {
[field: SerializeField] public ItemDefinition Item { get; private set; }
[field: SerializeField] public float DamageMultiplier { get; private set; } = 1;
public float GetDamage() {
return Item.Damage * DamageMultiplier;
}
public ItemInstance GetInstance() {
return new ItemInstance(this);
}
}
public struct ItemInstance {
public float damage;
public ItemInstance(ItemTierDefinition item) {
damage = item.GetDamage();
}
}
For example