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

Finite State Machines

In this chapter, we'll learn how to implement a Finite State Machine (FSM) in a Unity3D game by studying the simple tank game-mechanic example that comes with this book.

In our game, the player controls a tank. The enemy tanks move around the scene, following four waypoints. Once the player's tank enters the vision range of the enemy tanks, they will start chasing it; then, once they are close enough to attack, they'll start shooting at our player's tank.

To control the AI of our enemy tanks, we use FSM. First, we'll use simple switch statements to implement our tank AI states, then we'll use an FSM framework based on and adapted from the C# FSM framework that can be found at http://wiki.unity3d.com/index.php?title=Finite_State_Machine.

The topics we will be covering in this chapter are the following:

  • The player's tank
  • The Bullet class
  • Setting up waypoints
  • The abstract FSM class
  • The enemy tank AI
  • Using an FSM framework
主站蜘蛛池模板: 芒康县| 平武县| 平顶山市| 宝兴县| 永安市| 甘肃省| 磐石市| 铜川市| 木里| 施秉县| 永济市| 安阳县| 沧源| 博爱县| 普定县| 桃园县| 响水县| 当雄县| 涟水县| 汕头市| 台北市| 文水县| 汶上县| 沈阳市| 荆门市| 郑州市| 梅州市| 商河县| 德化县| 灌南县| 含山县| 曲周县| 库尔勒市| 宜宾市| 华安县| 洛南县| 威海市| 高雄市| 克什克腾旗| 襄垣县| 中山市|