How to do it...

Now, we implement the FightingCircle and StageManager classes:

  1. Create the FightingCircle class along with its member variables:
using UnityEngine; 
using System.Collections; 
using System.Collections.Generic; 
public class FightingCircle : MonoBehaviour 
    public int slotCapacity; 
    public int attackCapacity; 
    public float attackRadius; 
    public GameObject player; 
    public int slotsAvailable; 
    public int attackAvailable; 
    public List<GameObject> enemyList; 
    public Dictionary<int, Vector3> posDict; 
  1. Implement the Awake function for initialization:
void Awake() { slotsAvailable = slotCapacity; attackAvailable = attackCapacity; enemyList = new List<GameObject>(); ...

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.