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

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.

主站蜘蛛池模板: 高尔夫| 辽中县| 金溪县| 长丰县| 宁波市| 黎城县| 四会市| 秦皇岛市| 营山县| 绥化市| 屯留县| 甘南县| 兴业县| 泾源县| 长丰县| 五华县| 四会市| 修文县| 锡林浩特市| 达州市| 建平县| 青川县| 隆子县| 青河县| 木兰县| 睢宁县| 靖江市| 莱阳市| 克什克腾旗| 玉山县| 日照市| 林甸县| 台北市| 乌什县| 瓦房店市| 宁晋县| 哈尔滨市| 卢龙县| 阜新市| 依安县| 米林县|