Hey, since you mentioned you're a beginner, I would recommend you not getting too deep into academical stuff for now, all those fancy computer science patterns can cause more harm than benefit if used without enough confidence.
Think about it this way: a state machine - is a mechanism where you have some state
variable, usually an enum, with values like: idle
, patrol
, attack
, etc. And some logic of how these states change from one to another, like:
if (state == EnemyState.patrol) && playerDetected {
state = EnemyState.attack
}
Maybe one important thing to mention here is that e.g. stopAttack
- is a bad example of state, because it's basically not a state, but a momentary action, so you should avoid defining states like that.
The exact implementation of this logic, as well as its complexity, is up to you. You don't need any rules from smart articles to restrict you from defining your state machine the way you want.
And after successfully implementing your own state machine you will have enough experience to start looking at those articles and see which fancy ideas you could borrow from them to make your code even better.
Good luck!
And sorry if this is not exactly an answer you wanted to hear :)