Рет қаралды 17,445
Learn how you can implement Enemy AI with a Finite State Machine. This is a full implementation using Unity Hierarchical State Machine (Unity HFSM), a code-driven state machine framework for Unity.
👨💻 As always, all code from this video is available on GitHub: github.com/llamacademy/ai-ser...
👨💻 If you're just looking for Unity HFSM, it's here: github.com/Inspiaaa/UnityHFSM
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: www.jetbrains.com/store/?sect...
📚 Resources:
⚫ Unity HFSM: github.com/Inspiaaa/UnityHFSM
⚫ This super cool Llama: assetstore.unity.com/packages...
⚫ Unity Particle Pack (free): assetstore.unity.com/packages...
⚫ AI Series 44 (Movement Prediction): • Better Enemy Chasing w...
⚫ Damage System: • Damage Enemies and Obj...
⚫ Unity 2021 Object Pooling API: • Unity 2021 Object Pool...
⚫ Comparison of AI Behavior Frameworks: • Which AI Behavior Fram...
💸 Ongoing sales 💸
⚫ Check out the latest Humble Bundles www.humblebundle.com/software...
⚫ Publisher Sale! 50% OFF an entire publisher's Assets! Publisher changes weekly! assetstore.unity.com/publishe...
⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Supporter:
⚫ Patreon: / llamacademy
⚫ KZbin Member: / @llamacademy or click the Join button on any video
⚫ GitHub Sponsor: github.com/sponsors/llamacademy
----
I also have some Unity Assets: assetstore.unity.com/publishe...
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment
Chapters:
00:00 Topic Introduction
00:35 Unity HFSM Installation
01:25 What to Expect & High Level Design
02:50 FSM Design in Animator
06:22 Unity HFSM Key Classes - StateBase.cs, State.cs, StateMachine.cs
07:26 EnemyStateBase.cs Introduction
07:48 EnemyState.cs - Defines all possible states
08:00 StateEvent.cs - Defines all possible events
08:10 Enemy.cs - Set up State Machine with all states
09:58 EnemyStateBase.cs - Base State for all Enemy State Behaviors
11:45 IdleState.cs
12:18 ChaseState.cs
13:31 SpitState.cs & Spit.cs
14:45 AttackState.cs
15:22 BounceState.cs
15:34 RollState.cs
16:15 Add References & Update State Constructors - Enemy.cs
17:49 Detect Player Within Different Ranges - PlayerSensor.cs
18:18 Use Player Sensors - Enemy.cs
19:10 Add Chase/Idle Transitions - Enemy.cs
20:35 Add Roll Transitions - Enemy.cs
21:54 Detect Collisions while Rolling - RollImpactSensor.cs
23:16 Add Transitions to Other Attacks - Enemy.cs
23:58 Set up Objects in Unity Editor & Demo
25:12 Final Thoughts & Support LlamAcademy