Summary
We learned why a State Machine is a great way to glue the different parts of a game together, each part having it's own State of control. Then we learned a basic overview of the logic of switching States. We even took a brief glimpse into how Unity creates Components to help your understanding of code logic. Finally, we covered a way to guarantee that each State in a State Machine contains the required methods to make the State Machine work, by using a C# interface.
There are more great benefits for using a C# interface besides the programming interface it provides. In the next chapter, we get into the details of the State Machine and how the interface can work for us even more.
Get Learning C# by Developing Games with Unity 3D Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.