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

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.

主站蜘蛛池模板: 昌黎县| 夹江县| 榆社县| 厦门市| 会宁县| 兰考县| 雅江县| 嘉义县| 浙江省| 辰溪县| 铜梁县| 伊宁市| 左权县| 讷河市| 铁力市| 武平县| 绥滨县| 台北县| 长阳| 陵川县| 兴国县| 泰来县| 宣武区| 霸州市| 洪雅县| 夏邑县| 全椒县| 溧阳市| 龙口市| 田东县| 平潭县| 安康市| 巴中市| 长汀县| 涞水县| 蓝田县| 峡江县| 肃南| 汕头市| 新疆| 积石山|