Ejemplo n.º 1
0
    public void SetBackground()
    {
        for (int i = 0; i < objBackGrounds.Length; i++)
        {
            objBackGrounds[i].SetActive(i == (int)UserDataManager.Instance.currDifficulty);
        }

        for (int i = 1; i <= Constants.MaxStage; i++)
        {
            StageSlot newSlot = Instantiate(slotTemplate);
            newSlot.transform.parent = trHolder;
            newSlot.Init(i);
        }
    }
Ejemplo n.º 2
0
    //게임이 끝날 때
    public void SetFinishUI()
    {
        //일반 스테이지라면
        StageSlot currentStageSlot = StageManager.instance.currentStageSlot;

        StageManager.instance.go_Player.SetActive(false);
        if (currentStageSlot != null)
        {
            stageUI.DeactivateUI();
            //starCount가 1개 이상이면 Stage Clear
            if (starCount > 0 && StageManager.instance.isGoal)
            {
                SoundManager.instance.PlaySFX("Game_Clear");

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

                    //현재 Stage를 Clear 했으니 다음 Stage를 Open 시켜준다.
                    int stageIdx = currentStageSlot.stageNumber + 1;
                    if (stageIdx != stageSlots.Length)
                    {
                        if (stageSlots[stageIdx] == null)
                        {
                            Debug.Log("다음 스테이지 슬롯이 비어있습니다. 스테이지를 추가해주세요.");
                        }
                        else
                        {
                            stageSlots[stageIdx].StageSlotOpen();
                        }
                    }
                    else
                    {
                        //보스 스테이지 슬롯 오픈
                        bossStageSlot.BossStageSlotOpen();
                    }
                }
                stageClearUI.S_ActiveClearUI();
            }
            //클리어 못했을 시
            else
            {
                SoundManager.instance.PlaySFX("Game_Over");
                youDiedUI.S_ActiveYouDiedUI();
            }
        }
        //보스 스테이지라면
        else
        {
            bossStageUI.DeactivateUI();

            if (StageManager.instance.currentBossStageSlot.currentHp <= 0)
            {
                if (StageManager.instance.currentBossStageSlot.bossStageType != BossStageSlot.BossStageType.BounceAttack)
                {
                    if (StageManager.instance.panaltyPoint <= 0)
                    {
                        SoundManager.instance.PlaySFX("Game_Over");
                        youDiedUI.BS_ActiveYouDiedUI();
                        return;
                    }
                    if (StageManager.instance.panaltyPoint >= StageManager.instance.currentBossStageSlot.panaltyPoints[0] - StageManager.instance.currentBossStageSlot.panaltyPoints[1])
                    {
                        starCount = 3;
                    }
                    else if (StageManager.instance.panaltyPoint > 0 && StageManager.instance.panaltyPoint < StageManager.instance.currentBossStageSlot.panaltyPoints[0] - StageManager.instance.currentBossStageSlot.panaltyPoints[1])
                    {
                        starCount = 2;
                    }
                    else if (StageManager.instance.panaltyPoint > 0)
                    {
                        starCount = 1;
                    }
                }
                else
                {
                    starCount = 3;
                }

                SoundManager.instance.PlaySFX("Boss_Clear");

                int total = 0;

                if (StageManager.instance.currentBossStageSlot.bossStageStatus == BossStageSlot.BossStageStatus.Open)
                {
                    StageManager.instance.currentBossStageSlot.bossStageStatus = BossStageSlot.BossStageStatus.Clear;
                }

                if (bossStageSlot.bossStageStatus == BossStageSlot.BossStageStatus.Clear)
                {
                    if (StageManager.instance.currentBossStageSlot.starCount < starCount)
                    {
                        StageManager.instance.currentBossStageSlot.starCount = starCount;
                    }

                    StageManager.instance.chaptersStarCount[StageManager.instance.currentChapter - 1] += bossStageSlot.starCount;
                }

                for (int i = 0; i < StageManager.instance.currentChapter; i++)
                {
                    total += StageManager.instance.chaptersStarCount[i];
                }

                if (StageManager.instance.currentChapter != 4 && total >= StageManager.instance.chaptersUnlockStarCount[StageManager.instance.currentChapter - 1])
                {
                    nextButton.interactable = true;
                }
                else
                {
                    nextButton.interactable = false;
                }

                stageClearUI.BS_ActiveClearUI();
            }
            else
            {
                SoundManager.instance.PlaySFX("Game_Over");
                youDiedUI.BS_ActiveYouDiedUI();
            }
        }
    }