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
In questa pagina del sito puoi guardare il video online Make Your Games Expandable WIth Command Pattern della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Freedom Coding 15 luglio 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 972 volte e gli è piaciuto 49 spettatori. Buona visione!