06 State Machines

Location: Assets/Plugins/Animancer/Examples/06 State Machines

Namespace: Animancer.Examples.StateMachines

These examples demonstrate how you can organise complex systems using Finite State Machines to compartmentalise their logic, resulting in modular scripts which are easy to reuse, debug, and refactor. They use Animancer's state machine system, however the general concepts will work in practically any state machine system.

Note that these examples each have their own namespace and use some of the same class names.

01 Game Manager Compare an enum-based state machine with Animancer's Finite State Machine system for managing the behaviour of a simple golf game.
02 Creatures Manage the various actions a character can perform using states.
03 Interrupt Management Determine which states can interrupt each other using a simple enum.
04 Brains Implement some states with actual functionality and a "Brain" script to control the creature using keyboard input.
05 More Brains Control each creature differently by using different brains even though they share the same scripts for actually performing actions.
06 Weapons Implement a character that can move around and attack with various different weapons.
07 Platformer Make a character controller for a 2D platformer using the ideas introduced in the above examples.