In this Unity Scripting tutorial we will learn about achieving separation of concerns using Finite State Machine pattern. We will see how separating code to different classes (states) will allow us to provide better maintenability and a little bit cleaner code. It's one of those design patterns that if you fall in love with you won't be able to stop using. Don't be scared by the amount of setup code - this is really worth it as it allows you to write less code (and better code!) later on.
Discord: / discord
Code: https://github.com/x1r15/StateMachine...
Celeste controller:
https://github.com/NoelFB/Celeste/blo...
Fantastic article about State Machine:
https://www.raywenderlich.com/6034380...
00:00 Question?
00:18 What's the problem?
01:01 Regular Player Controller
02:00 General Idea & Benefits
05:47 Code explanation - intro
06:15 Code explanation - state
10:00 Creating states as Scritable Objects
10:37 Code explanation - example state (walk)
13:23 Code explanation - example state (jump)
15:12 Code explanation - state runner
18:40 CHALLANGE QUESTION
19:58 Code explanation - character controller
Смотрите видео How to implement Finite State Machine in Unity онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь PitiIT 27 Апрель 2022, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 15,736 раз и оно понравилось 385 людям.