private void Awake() { Mapping = new MapScript(Line, Min, Max); Maps = Mapping.Init(); do { x = Random.Range(0, Line); y = Random.Range(0, Line); NowMap = Maps[y, x]; } while (!NowMap.isLive); NowEnemy = NowMap.NowEnemy; foreach (MapScript.Map map in Maps) { if (map.isLive) { for (int i = 0; i < 5; i++) { map.Enemy[i] = Instantiate(Enemys[Random.Range(0, 3)], new Vector3(-8 + 4 * i, 10, 0), new Quaternion(0, 0, 0, 0), EnemyParent.transform); if (map != NowMap) { map.Enemy[i].SetActive(false); } } } } Enemy.OnEnemyDead += EnemyDead; }