How to implement Finite State Machine in Unity

แชร์
ฝัง
  • เผยแพร่เมื่อ 13 มิ.ย. 2024
  • 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: github.com/x1r15/StateMachine...
    Celeste controller:
    github.com/NoelFB/Celeste/blo...
    Fantastic article about State Machine:
    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
  • วิทยาศาสตร์และเทคโนโลยี

ความคิดเห็น •