Unity3D Tutorial: State Machine

Also commonly called a finite-state machine (FSM), a state machine is a concept of something that can be in one state of a finite number of them.
Warning: This specific tutorial is not for beginners, it expects you to have most basic knowledge already mastered.