The abstract FSM class

Next, we implement a generic abstract class to define the methods that our enemy tank AI class has to implement.

The code in the FSM.cs file is as follows:

using UnityEngine; using System.Collections; public class FSM : MonoBehaviour { //Player Transform protected Transform playerTransform; //Next destination position of the NPC Tank protected Vector3 destPos; //List of points for patrolling protected GameObject[] pointList; //Bullet shooting rate protected float shootRate; protected float elapsedTime; //Tank Turret public Transform turret { get; set; } public Transform bulletSpawnPoint { get; set; } protected virtual void Initialize() { } protected virtual void FSMUpdate() { } protected virtual void FSMFixedUpdate() ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.