Summary

In this chapter, we reviewed a pattern that's the cornerstone of game development. We now have the ability to encapsulate stateful behaviors into individual components that can be assigned dynamically to an object depending on its state. We have reduced our dependency on long conditional statements and have a consistent approach to structuring our code that's related to behaviors and state management.

In the next chapter, we are going to review the Visitor pattern, a unique pattern that gives us the ability to decouple algorithms from an object's structure.

Get Hands-On Game Development Patterns with Unity 2019 now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.