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; 
    [HideInInspector] 
    public int slotsAvailable; 
    [HideInInspector] 
    public int attackAvailable; 
    [HideInInspector] 
    public List<GameObject> enemyList; 
    [HideInInspector] 
    public Dictionary<int, Vector3> posDict; 
} 
  1. Implement the Awake function for initialization:
void Awake() { slotsAvailable = slotCapacity; attackAvailable = attackCapacity; enemyList = new List<GameObject>(); ...

Get Complete Unity 2018 Game Development now with O’Reilly online learning.

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