-
Notifications
You must be signed in to change notification settings - Fork 0
Command
The command pattern will rely the execution of certain actions to a command processor and the logic of that actions to each command. The pattern also allow us to have a persistence of this actions, this is the major utility of this pattern. For example, if we want to store the actions that a player did during a match in order to save a replay of that match, we will probably use the command pattern.
In this example we are going to make an undo functionality of the movements the player does. For this we will use this infrastructure:

The character will read the input for the player movement, adding every command of the movement to the command processor and then executing it. Then when we want to undo this movements we simply tell the command processor to cycle through the list of movements from the newer one to the last one, and execute them.
The code can be seen in this link
Home
C#
Game Design Patterns
- Command
- Flyweight pattern & Scriptable Objects
- Observer pattern
- State pattern
- Object Pool pattern
- Factory pattern
ECS
PlayFab
- Introduction
- Template Class
- Player Authentication
- Mobile Authentication
- Player Statistics
- Leaderboard
- Player Data
- Friends
Mirror