Advertisement
Guest User

Untitled

a guest
Apr 30th, 2024
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.01 KB | None | 0 0
  1. [Sytem.Serializable]
  2. struct CardEffectData
  3. {
  4. // add your desired effect data here
  5. public string NameID;
  6. public Color PrimaryColor;
  7. public Color SecondaryColor;
  8. }
  9.  
  10. [CreateAssetMenu(fileName = "CardEffects", menuName = "CardEffects", order = 1)]
  11. public sealed class CardEffects : ScriptableObject
  12. {
  13. // you can use these lists directly if you're OK with integer IDs
  14. public List<CardEffectData> FireCardEffects;
  15. public List<CardEffectData> WaterCardEffects;
  16.  
  17. // if you want card effects accessible through a string ID, you can unify the effects in a Dictionary
  18. public Dictionary<string, CardEffectData> AllEffects = new Dictionary<string, CardEffectData>();
  19.  
  20. // Call this in some script in Awake or Start to initialize the Dictionary unification
  21. public void Initialize()
  22. {
  23. UnifyData(FireCardEffects);
  24. UnifyData(WaterCardEffects);
  25. }
  26.  
  27. private void UnifyData(List<CardEffectData> list)
  28. {
  29. for(int i = 0; i < list.Count; i++)
  30. {
  31. AllEffects.Add(list[i].NameID, list[i]);
  32. }
  33. }
  34. }
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement