public void SpawnNewEnemy()
    {
        GameObject               m_enemy                  = Instantiate(enemy, transform.position, transform.rotation) as GameObject;
        EnemyController          enemyController          = m_enemy.GetComponent <EnemyController>();
        EnemyControllerDefensive enemyControllerDefensive = m_enemy.GetComponent <EnemyControllerDefensive>();

        if (enemyController)
        {
            Debug.Log("follow enemies");
            enemyController.waypoints      = waypoints.ToArray();
            enemyController.waypointRadius = waypointRadius;
        }
        else if (enemyControllerDefensive)
        {
            if (enemyControllerDefensive)
            {
                Debug.Log("defensive enemies");
            }
            enemyControllerDefensive.waypoints = waypoints.ToArray();
            enemyControllerDefensive.maxDistanceFromPatrolArea = maxDistanceFromPatrolArea;
            enemyControllerDefensive.maxLockOnTime             = maxLockOnTime;
            enemyControllerDefensive.maxDistanceFromTarget     = maxDistanceFromTarget;
        }
        else
        {
            Debug.LogError("error, no enemy controller");
        }
    }
 // Use this for initialization
 public void Start()
 {
     enemyControllerDefensive = transform.root.GetComponent <EnemyControllerDefensive>();
     SharpUnit.Assert.NotNull(enemyControllerDefensive);
     SharpUnit.Assert.NotNull(enemyControllerDefensive.targetLayerMaskLockOn);
 }
 // Use this for initialization
 public void Start()
 {
     enemyControllerDefensive = transform.root.GetComponent<EnemyControllerDefensive>();
     SharpUnit.Assert.NotNull(enemyControllerDefensive);
     SharpUnit.Assert.NotNull(enemyControllerDefensive.targetLayerMaskLockOn);
 }