I am an amateur Unity game developer working on a game that features a policy card system similar to Civilization 6. Currently, my code feels difficult to extend and I'm not sure which design pattern would be best suited for this feature.
However, I'm worried that this approach might not be scalable as more policy cards are added to the game. What design pattern should I use to make the system more flexible and easy to extend? How can I implement it in Unity? Any code examples or resources would be greatly appreciated.
Thank you in advance for your help!
Regarding the interference of policy cards with other systems, I tried to use the observer pattern. I let other systems register for events from the policy card system. Every time a policy card is mounted, the event is broadcasted. However, I encountered some issues with handling numerical values. For example, if I want a certain policy card to increase the HP of a unit, I found that my current code is a mess.
Aucun commentaire:
Enregistrer un commentaire