示例#1
0
    //게임이 끝날 때
    public void SetFinishUI()
    {
        //일반 스테이지라면
        if (StageManager.instance.currentStageSlot != null)
        {
            //starCount가 1개 이상이면 Stage Clear
            if (starCount > 0 && StageManager.instance.isGoal)
            {
                gameOverUI.gameoverText.text  = "STAGE CLEAR!";
                gameOverUI.gameoverText.color = Color.blue;

                //만약 현재 stageSlot이 Open만 된 상태였다면 Clear로 변경
                if (StageManager.instance.currentStageSlot.stageStatus == StageSlot.StageStatus.Open)
                {
                    StageManager.instance.currentStageSlot.stageStatus = StageSlot.StageStatus.Clear;

                    //현재 Stage를 Clear 했으니 다음 Stage를 Open 시켜준다.
                    if (StageManager.instance.currentStageSlot.stageNumber + 1 != stageSlots.Length)
                    {
                        stageSlots[StageManager.instance.currentStageSlot.stageNumber + 1].StageSlotOpen();
                    }
                    else
                    {
                        //보스 스테이지 슬롯 오픈
                        bossStageSlot.BossStageSlotOpen();
                    }
                }
            }
            else
            {
                gameOverUI.gameoverText.text  = "GAME OVER";
                gameOverUI.gameoverText.color = Color.red;
            }

            if (StageManager.instance.currentStageSlot.stageNumber + 1 != stageSlots.Length)
            {
                if (stageSlots[StageManager.instance.currentStageSlot.stageNumber + 1] != null)
                {
                    if (stageSlots[StageManager.instance.currentStageSlot.stageNumber + 1].stageStatus != StageSlot.StageStatus.Rock)
                    {
                        nextButton.interactable = true;
                    }
                    else
                    {
                        nextButton.interactable = false;
                    }
                }
                else
                {
                    nextButton.interactable = false;
                }
            }
            else
            {
                if (bossStageSlot.bossStageStatus != BossStageSlot.BossStageStatus.Rock)
                {
                    nextButton.interactable = true;
                }
                else
                {
                    nextButton.interactable = false;
                }
            }

            gameOverUI.gameoverScoreText.text = StageManager.instance.score.ToString();
            stageUI.DeactivateUI();
            gameOverUI.go_StageGameoverUI.SetActive(true);
        }
        //보스 스테이지라면
        else
        {
            if (StageManager.instance.currentBossStageSlot.currentHp <= 0)
            {
                if (StageManager.instance.currentBossStageSlot.challengeCount <= StageManager.instance.currentBossStageSlot.checkChallengeCount[0])
                {
                    for (int i = 0; i < 3; i++)
                    {
                        gameOverUI.bossStageStarImages[i].sprite = starSprite;
                    }
                    starCount = 3;
                }
                else if (StageManager.instance.currentBossStageSlot.challengeCount <= StageManager.instance.currentBossStageSlot.checkChallengeCount[1])
                {
                    for (int i = 0; i < 2; i++)
                    {
                        gameOverUI.bossStageStarImages[i].sprite = starSprite;
                    }
                    starCount = 2;
                }
                else
                {
                    gameOverUI.bossStageStarImages[0].sprite = starSprite;
                    starCount = 1;
                }

                gameOverUI.bossGameoverText.text  = "BOSS CLEAR!";
                gameOverUI.bossGameoverText.color = Color.blue;
            }
            else
            {
                gameOverUI.bossGameoverText.text  = "GAME OVER";
                gameOverUI.bossGameoverText.color = Color.red;
            }

            gameOverUI.SetGameoverUI();
            bossStageUI.DeactivateUI();
        }
    }