Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class BaseKeyValueData<TKey, TValue> : ScriptableObject
- {
- [SerializeField] private TValue _default;
- [SerializeField] private List<DataPair<TKey, TValue>> _dataPairs;
- public IEnumerable<DataPair<TKey, TValue>> Pairs => _dataPairs;
- public TValue GetValue(TKey key)
- {
- foreach ((TKey key1, TValue value) in Pairs)
- if (key1.Equals(key))
- return value;
- return _default;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment