Skip to content

Latest commit

 

History

History
22 lines (14 loc) · 1.38 KB

File metadata and controls

22 lines (14 loc) · 1.38 KB

[Unity/C#] Finite State Machines

Mina Pêcheux - July 2021

What are FSMs, aka Finite State Machines? How can we use one to implement basic physics-based 2D player movement? Let's discover more in these 2 video/text tutorials:

  • "How to make a basic finite state machine in less than 30 minutes" (read it on Medium or watch it on Youtube)
  • "How to make a hierarchical finite state machine in less than 30 minutes" (read it on Medium or watch it on Youtube)

thumbnail01 thumbnail02

In these tutorials, I'm discussing how we can model entity behaviour via state machines, what are the benefits and the costs of implementing one and how hierarchical state machines can help you share logic without repeating code. The series uses 2D physics-based player movement (with rigidbodies) as a direct application example.

This Github repo contains the code that is written throughout those tutorials:

  • the parent virtual classes that define state machines and their inherent states
  • the actual instantiable classes derived from those for our specific 2D-movement state machine

demo