MinaPecheux / UnityTutorials-FiniteStateMachines

The code for a short tutorial on finite state machines and how to use them for basic 2D physics-based player movement in Unity/C# (in text or video format).

Home Page:https://minapecheux.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[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

About

The code for a short tutorial on finite state machines and how to use them for basic 2D physics-based player movement in Unity/C# (in text or video format).

https://minapecheux.com

License:MIT License


Languages

Language:C# 100.0%