[Question] Need some help on SpawnerManager.cs

Hi ladies & gentlemen,

A little background of the development. I have completed the glitch garden video and have uploaded it at gamebucket. However, i am currently looking for some tweaks on the spawning (adding some condition). So instead of creating a spawner script at each of the spawner game object as per the video. I have created a spawnerManager.cs and attached it to the parent (Spawners). The idea is similar to the player respawning code which is available at zombie runner.

I’ve tested the basic things and it works fine. Enemy are spawning. However, when i wanted to introduce something different, and then… i am stucked.

Things i wanted to do:
There are 2 types of enemies in this game, namely Lizard and fox. I have an attackerPrefabArray that keeps them.
There are 5 lanes in total. As for now, the creeps are spawned randomly to the lanes. For each of the lane, i wish not to have repeating enemy. Hence, the maximum enemy shall be two (1 type each).

In my mind, the approach can be something like - do a checking, using lizard as example, if there is a lizard already exist in the lane, do not spawn it. So, I wish to create a bool to check whether there are lizard component in the lane itself.

Problem: Since this is a spawnerManager.cs, The spawn method is designed to spawn the attacker to lane randomly. How do i let my bool know that which lane it is currently pointing to so that i can do the checking? (the idea is, if it is decided to spawn Lizard at lane 4, check and see if there is any lizard component exist in lane 4, if yes, do not spawn, else spawn).

[the image below is just to show the hierachy of the spawner, the error is not relevant here]

  1. Do a childcount on the child- spawner, if there are more than 2 enemy, do not spawn it.
    Problem: i think i can solve this if Q1 above is being answered =X

    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;

    public class SpawnerManager : MonoBehaviour {

     private GameObject spawnerManager;
     public GameObject[] attackerPrefabArray;
     public Transform EnemySpawnPoints;
     private Transform[] spawnPoints;
    
     // Use this for initialization
     void Start () {
     	spawnPoints = EnemySpawnPoints.GetComponentsInChildren<Transform> ();
     	print ("spawnpoint" +spawnPoints.Length);
    
     }
    
     
     // Update is called once per frame
     void Update () {
     
    
     	foreach (GameObject thisAttacker in attackerPrefabArray) {
     		if (isTimeToSpawn (thisAttacker)) {
     			// lizard is under value of [1] of the attackerPrefabArray (fox is 0)
     			// if this attacker is lizard, and there is a no lizard child in this spawner, spawn it
    
     			if ((thisAttacker == attackerPrefabArray.GetValue (1)) && IsLizardAllowedToBeSpawned(thisAttacker))
     				Spawn (thisAttacker);
     			if ((thisAttacker == attackerPrefabArray.GetValue (0)))
     				Spawn (thisAttacker);
     			
     		
     		
     		}
     	}
     }
     	
    
    
    
     bool isTimeToSpawn(GameObject attackerGameObject){
     	
     	
     			Attacker attacker = attackerGameObject.GetComponent<Attacker>();
     			float meanDelayTime = attacker.seenEverySeconds;
     			float spawnsPerSecond = 1 / meanDelayTime;
     	
     			if (Time.deltaTime > meanDelayTime) {
     				Debug.LogWarning ("spawnrate capped at frame rate");
     			} 
     			float threshold = spawnsPerSecond * Time.deltaTime  ; //is to normalise
     	
     			if (Random.value < threshold) {
     				return true;
     	
     			} else {
     				return false;
     			}
     				
     		
     		}
    
     void Spawn(GameObject myGameObject){
     	//this is random spawning at random lane
    
     	GameObject myAttacker = Instantiate (myGameObject) as GameObject;
     	
     	int i = Random.Range (1, spawnPoints.Length);
    
     	myAttacker.transform.parent = spawnPoints[i].transform;
     	myAttacker.transform.position = spawnPoints[i].transform.position;
    

    }
    }

Thanks for your time and your kind assistance on this matter.