안녕하세요. unity 독학 이제 이주차입니다.

간단한 횡스크롤 슈팅게임을 제작하고 있는데 적 스폰에서 막혀 3일째 고민하다가 질문드립니다.


public void SpawnEnemy()
    {  
        if(curenemycount < midenemycount)
        {
            int ranEnemy = Random.Range(0, 2);
                int ranPoint = Random.Range(0, 5);
                GameObject enemy = Instantiate(enemyObjs[ranEnemy], spawnPoints[ranPoint].position, spawnPoints[ranPoint].rotation);
                Rigidbody2D rigid = enemy.GetComponent<Rigidbody2D>();
                Enemy enemyLogic = enemy.GetComponent<Enemy>();
                curenemycount++;
                enemyLogic.player = player;
                enemyLogic.gameManager = this;
        }
        else if(curenemycount == midenemycount)
        {
            GameObject A = Instantiate(BossA, bosspoint.position, bosspoint.rotation);
            Rigidbody2D rigid = A.GetComponent<Rigidbody2D>();
            curbossA_count++;
        }
        else if (curenemycount > midenemycount && curenemycount < maxenemycount)
        {
            int ranEnemy = Random.Range(0, 3);
            int ranPoint = Random.Range(0, 5);
            GameObject enemy = Instantiate(enemyObjs[ranEnemy], spawnPoints[ranPoint].position, spawnPoints[ranPoint].rotation);
            Rigidbody2D rigid = enemy.GetComponent<Rigidbody2D>();
            Enemy enemyLogic = enemy.GetComponent<Enemy>();
            curenemycount++;
            enemyLogic.player = player;
            enemyLogic.gameManager = this;
        }
        else if(curenemycount == midenemycount)
        {
            GameObject B = Instantiate(BossB, bosspoint.position, bosspoint.rotation);
            Rigidbody2D rigid = B.GetComponent<Rigidbody2D>();
            curbossB_count++;
        }


BossA가 스폰된 이후 health가 0이 되어도 다음으로 넘어가지 않습니다 ㅠ


참고로 health는 다른 스크립트에 있어서 health<=0일 경우 bool bossdie = true로 하여 bool 값을 받아오는것도 시도해보았는데

public void SpawnEnemy()
    {  
        if(curenemycount < midenemycount)
        {
            int ranEnemy = Random.Range(0, 2);
                int ranPoint = Random.Range(0, 5);
                GameObject enemy = Instantiate(enemyObjs[ranEnemy], spawnPoints[ranPoint].position, spawnPoints[ranPoint].rotation);
                Rigidbody2D rigid = enemy.GetComponent<Rigidbody2D>();
                Enemy enemyLogic = enemy.GetComponent<Enemy>();
                curenemycount++;
                enemyLogic.player = player;
                enemyLogic.gameManager = this;
        }
        else if(curenemycount == midenemycount)
        {
            BossASpawn();
        }
        else if(bossADie == true)
            curenemycount++;
       
        else if (curenemycount > midenemycount && curenemycount < maxenemycount)
        {
            int ranEnemy = Random.Range(0, 3);
            int ranPoint = Random.Range(0, 5);
            GameObject enemy = Instantiate(enemyObjs[ranEnemy], spawnPoints[ranPoint].position, spawnPoints[ranPoint].rotation);
            Rigidbody2D rigid = enemy.GetComponent<Rigidbody2D>();
            Enemy enemyLogic = enemy.GetComponent<Enemy>();
            curenemycount++;
            enemyLogic.player = player;
            enemyLogic.gameManager = this;
        }
        else if(curenemycount == midenemycount)
        {
            BossBSpawn();
        }
                   
    }
    void BossASpawn()
    {
        if(curbossA_count == maxbossA_count)
            if(bossADie == true)
                curenemycount++;
            else
                return;

        else
        {
            GameObject A = Instantiate(BossA, bosspoint.position, bosspoint.rotation);
            Rigidbody2D rigid = A.GetComponent<Rigidbody2D>();
            curbossA_count++;    
        }
    }
    void BossBSpawn()
    {
        if(curbossB_count == maxbossB_count)
            if(bossBDie == true)
                SceneManager.LoadScene("Clear");
            else
                return;

        else
        {
            GameObject B = Instantiate(BossB, bosspoint.position, bosspoint.rotation);
            Rigidbody2D rigid = B.GetComponent<Rigidbody2D>();
            curbossB_count++;
        }
    }

bool값이 읽어지지 않고 잘 되지 않았습니다


코드를 어떻게 고치면 좋을지 알려주시면 감사하겠습니다 ㅠㅠ