Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [Sytem.Serializable]
- struct CardEffectData
- {
- // add your desired effect data here
- public string NameID;
- public Color PrimaryColor;
- public Color SecondaryColor;
- }
- [CreateAssetMenu(fileName = "CardEffects", menuName = "CardEffects", order = 1)]
- public sealed class CardEffects : ScriptableObject
- {
- // you can use these lists directly if you're OK with integer IDs
- public List<CardEffectData> FireCardEffects;
- public List<CardEffectData> WaterCardEffects;
- // if you want card effects accessible through a string ID, you can unify the effects in a Dictionary
- public Dictionary<string, CardEffectData> AllEffects = new Dictionary<string, CardEffectData>();
- // Call this in some script in Awake or Start to initialize the Dictionary unification
- public void Initialize()
- {
- UnifyData(FireCardEffects);
- UnifyData(WaterCardEffects);
- }
- private void UnifyData(List<CardEffectData> list)
- {
- for(int i = 0; i < list.Count; i++)
- {
- AllEffects.Add(list[i].NameID, list[i]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement