Command pattern will help you to make your games more expandable, separate your code into multiple pieces, and allow you to queue up commands, undo or redo them if you need to. This pattern consists of 5 elements. First is the client that creates the commands. Second is the invoker which executes the commands. Third is the command itself which can be an interface from which all the commands inherit. Fourth is the concrete command, such as move, run, attack, and so on. The fifth one is the receiver which gets called from the concrete command and contains all the logic. The command pattern is widely used in all kinds of games and apps. Today, I will teach you how to use it with Unity and C# on a simple example of a turn-based game.
Project Files - https://github.com/Freedom-Coding/Des...
👍 Like and 🔔Subscribe for More Unity and C# Tutorials / @freedomcoding
🌟 Support My Work and Unlock Exclusive Content! 🌟
👉 Patreon: / freedomcoding
🎮 Join Our Developer Community!
💬 Discord: / discord
💖 Support Me Financially
☕ PayPal, Revolut: marek.freedom.coding@gmail.com
Website - https://www.freedom-coding.com
Timestamps:
00:00 Intro
00:18 What Is Command Pattern?
00:46 Understanding Command Pattern
02:35 Client (player inputs)
03:00 Command (interface)
03:29 Concrete Command (move)
04:20 Invoker (command manager)
06:30 Receiver (player mover)
08:42 Code Overview
09:48 Testing
10:34 Adding More Commands
11:51 Conclusion
Sur cette page du site, vous pouvez voir la vidéo en ligne Make Your Games Expandable WIth Command Pattern durée heure minute seconde en bonne qualité , qui a été Téléchargé par l'utilisateur Freedom Coding 15 juillet 2024, Partagez le lien avec vos amis et connaissances, sur youtube cette vidéo a déjà été regardée 972 fois et il a aimé 49 téléspectateurs. Bon visionnage!