Many Objects Communicating? Use Mediator! || Unity Tutorial




The mediator pattern is handy when you have many objects you need to control. Without the mediator, there would be many dependencies and each of the objects would need to know about each other. When using the mediator, the objects don’t know about the other objects, instead, they contact the mediator, which decides what will happen and can notify the other objects. This pattern will help you to follow the single-responsibility and the open-closed principle, decouple your code, and achieve centralized control over the objects.

👍 Like and 🔔Subscribe for More Unity and C# Tutorials https://www.youtube.com/@UClTnTUyCeSu9tN8FNNoXMRg

🌟 Support My Work and Unlock Exclusive Content! 🌟
👉 Patreon: https://www.patreon.com/FreedomCoding

🎮 Join Our Developer Community!
💬 Discord: https://discord.gg/JzssYyjvGu

💖 Support Me Financially
☕ PayPal, Revolut: marek.freedom.coding@gmail.com

Project Files – https://www.patreon.com/posts/114347613
Website – https://www.freedom-coding.com

Timestamps:
00:00 Why To Use Mediator?
00:51 Player And Mediator Abstractions
01:55 Managing Player Turns
04:44 Notifying All Players
07:22 Notifying Players In Range
09:05 Notyfying Only Enemies
12:20 Testing
13:59 Conclusion, Pros & Cons

Voir sur youtube

Nous serions ravis de connaître vos opinions.

Laisser un commentaire

KA2Studio
Logo
Compare items
  • Total (0)
Compare
0