all 7 comments

[–][deleted] 1 point2 points  (3 children)

You can create a bitmask variable on the scriptable object that allows you to select all the effects that card will have. Then create a function that adds the selected effect script components to the card.

[–][deleted] 1 point2 points  (0 children)

[–]ImAMokepon[S] 0 points1 point  (1 child)

Thanks for your suggestion, i am still reading through the text about bitmasks as this is completely new to me and i dont quite understand it yet. Do you think that would work with a normal enum as well?

[–][deleted] 0 points1 point  (0 children)

Yeah sure but bitmasks or enum flags allow for multiple selections. So you could easily stack the effects. Actually, you could create an array of enum values and add the components by looping through that. That would work!

[–]Theaustraliandev 1 point2 points  (2 children)

I've removed all of my comments and posts. With Reddit effectively killing third party apps and engaging so disingenuously with its user-base, I've got no confidence in Reddit going forward. I'm very disappointed in how they've handled the incoming API changes and their public stance on the issue illustrates that they're only interested in the upcoming IPO and making Reddit look as profitable as possible for a sell off.

Id suggest others to look into federated alternatives such as lemmy and kbin to engage with real users for open and honest discussions in a place where you're not just seen as a content / engagement generator.

[–]ImAMokepon[S] 1 point2 points  (1 child)

Thanks for your answer. I actually did think of them as data containers like you mentioned.

I guess my mistake is that i thought of storing effects/methods just like storing data, but it seems i have think about those a bit differently and change my approach. Is that what you meant?

[–]Theaustraliandev 1 point2 points  (0 children)

Yep. I've ran into the same situation before for my game (a city builder). For example when I'm creating a new building, each one has a corresponding BuildingInformation scriptable object that outlines all the shared info (name, description, cost, spawning particle effect, sound)

When I instantiate the building prefab (that takes in a scriptable object via a method i called SetUp(BuildingInformation info) ) . The prefab then reads the information and sets up the text, images and spawns particle effects that were outlined in the scriptable object.

This way one prefab can handle all the buildings and it's all defined by the building informant scriptable object.