public void CreateRandomEnemies() { // TEMP create a few enemies for (int i = 0; i < EnemyNumber; i++) { float min = Mathf.Max(Mathf.Lerp(0, EnemyPrefabs.Length - 3, _difficulty * 0.01f), 0); float max = Mathf.Min(Mathf.Lerp(3, EnemyPrefabs.Length, _difficulty * 0.01f), EnemyPrefabs.Length); GameObject go = Instantiate(EnemyPrefabs[(int)Random.Range(min, max)]); EnemyUnit enemy = go.GetComponent <EnemyUnit>(); enemy.name += " (" + i + ")"; _enemies.Add(enemy); int pos = Random.Range(9, 18); while (Battleground.Instance.GetUnitOnTile(pos) != null) { pos = Random.Range(9, 18); } Battleground bg = FindObjectOfType <Battleground>(); bg.PlaceUnitAt(enemy, pos); //create UI CharacterUI UI = Instantiate(EnemyUIPrefab).GetComponent <CharacterUI>(); enemy.AssignUI(UI); UI.SetEnemyTell(true); enemy.DealAnotherCard(); } }