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

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
主站蜘蛛池模板: 且末县| 宣武区| 寿阳县| 永修县| 汤阴县| 进贤县| 上栗县| 买车| 南丹县| 长岛县| 南投县| 工布江达县| 雷山县| 六安市| 密云县| 黄石市| 临夏县| 通山县| 凤城市| 威远县| 北京市| 辽中县| 丽江市| 张家口市| 乐亭县| 白山市| 五莲县| 隆回县| 镇赉县| 威海市| 武城县| 雷波县| 延长县| 准格尔旗| 龙口市| 盱眙县| 怀远县| 河南省| 上思县| 临湘市| 桦甸市|