November 2018
Beginner
246 pages
5h 23m
English
The AdvanceFSM class basically manages all the FSMState classes we've implemented, and keeps updated with the transitions and the current state. So, the first thing to do before using our framework is to declare the transitions and states that we plan to implement for our AI tanks.
The code in the AdvancedFSM.cs file is as follows:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public enum Transition
{
None = 0,
SawPlayer,
ReachPlayer,
LostPlayer,
NoHealth,
}
public enum FSMStateID
{
None = 0,
Patrolling,
Chasing,
Attacking,
Dead,
}
It has a list object to store the FSMState objects, and two local variables to store the current ID of the FSMState class and current FSMState itself.
The ...
Read now
Unlock full access