官术网_书友最值得收藏!

Finite State Machines and You

In this chapter, we'll expand our knowledge of the FSM pattern and its uses in games and learn how to implement it in a simple Unity game. We will create a tank game with the sample code that comes with this book. We'll be dissecting the code and the components in this project. The topics we'll cover are as follows:

  • Understanding Unity's state machine features
  • Creating our own states and transitions
  • Creating a sample scene using examples

Unity 5 introduced state machine behaviors, which are a generic expansion of the Mecanim animation states that were introduced in the 4.x cycle. These new state machine behaviors, however, are independent of the animation system, and we will learn to leverage these new features to quickly implement a state-based AI system.

In our game, the player will be able to control a tank. The enemy tanks will be moving around in the scene with reference to four waypoints. Once the player tank enters their visible range, they will start chasing us, and once they are close enough to attack, they'll start shooting at our tank agent. This simple example will be a fun way to get our feet wet in the world of AI and state FSMs.

主站蜘蛛池模板: 哈巴河县| 朔州市| 万安县| 哈密市| 钟祥市| 凤城市| 哈尔滨市| 甘谷县| 公主岭市| 大姚县| 四子王旗| 齐河县| 沾益县| 靖边县| 宣威市| 隆尧县| 视频| 绿春县| 五峰| 延庆县| 龙里县| 永吉县| 昭苏县| 泸西县| 武隆县| 乌恰县| 定远县| 遵化市| 利津县| 且末县| 公主岭市| 库伦旗| 含山县| 十堰市| 龙岩市| 黄石市| 荣昌县| 资中县| 章丘市| 永新县| 汉源县|