Developing state structure
The zombie character has four main states, and therefore the zombie FSM must decide which state should be activated at any time, and which logic should govern the relationship between states. To start implementing the FSM, we'll write the following code, to create a state change function which sets the FSM to a specified state from any of the four available states. Comments follow the code:
//------------------------------------ using UnityEngine; using System.Collections; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; //------------------------------------ public class AIEnemy : MonoBehaviour { //------------------------------------ public enum AISTATE {IDLE = 0, CHASE = 1, ATTACK = 2, DEAD = 3}; [SerializeField] private AISTATE mActiveState = AISTATE.IDLE; public AISTATE ActiveState { get{ return...