Exemple #1
0
 void PopupResult(string result)
 {
     if (result == "yes")
     {
         BattleDayDungeonManager.DayDungeonServerConnect(DayDungeonServerConnectType.BuyTicket, BuyTicketResult);
     }
 }
Exemple #2
0
 public void SelectDay()
 {
     BattleDayDungeonManager.DayDungeonServerConnect(DayDungeonServerConnectType.SelectDay, ServerResult);
 }
Exemple #3
0
 void BattleStart()
 {
     BattleDayDungeonManager.DayDungeonServerConnect(DayDungeonServerConnectType.BattleStart, BattleStartResult);
 }
Exemple #4
0
    /// <summary> 배틀 진행 </summary>
    IEnumerator BattleProcess()
    {
        if (onStartBattle != null)
        {
            onStartBattle();
        }


        float startTime   = Time.time;
        float elapsedTime = 0f;

        ////페이드인
        battlePhase   = BattlePhase.FadeIn;
        fadeInProcess = 0f;
        while (elapsedTime < battleFadeInTime)
        {
            fadeInProcess = elapsedTime / battleFadeInTime;

            elapsedTime = Time.time - startTime;

            yield return(null);
        }

        fadeInProcess = 1f;

        //전투 준비
        battlePhase = BattlePhase.Ready;

        //전투
        battlePhase = BattlePhase.Battle;

        //영웅들 하나씩 출전
        yield return(StartCoroutine(SpawnHero(BattleUnit.Team.Red)));

        //상대 팀 출전
        yield return(StartCoroutine(SpawnHero(BattleUnit.Team.Blue)));



        //스테이지 시작 trigger
        for (int i = 0; i < redTeamList.Count; i++)
        {
            BattleHero hero = redTeamList[i];
            for (int a = 0; a < hero.buffController.buffList.Count; a++)
            {
                Buff buff = hero.buffController.buffList[a];
                if (buff.baseData.trigger != "OnStartStage")
                {
                    continue;
                }

                if (buff.triggerProbability < UnityEngine.Random.Range(1, 10001))
                {
                    continue;
                }

                BattleUnit target = null;
                if (buff.baseData.triggerTarget == "SkillTarget")
                {
                    target = hero;
                }
                else if (buff.baseData.triggerTarget == "BuffTarget")
                {
                    target = hero;
                }

                if (target && !target.isDie)
                {
                    target.buffController.AttachBuff(hero, buff.baseData.triggerBuff, 1, buff);
                }
            }
        }
        for (int i = 0; i < blueTeamList.Count; i++)
        {
            BattleHero hero = blueTeamList[i];

            // 던전 버프 적용
            string key = UIDayDungeonLobby.Instance.currentTapDay.ToString() + "_" + UIDayDungeonLobby.Instance.dungeonLevel;
            if (GameDataManager.dayDungeonBaseDataDic.ContainsKey(key))
            {
                DayDungeonBaseData data = GameDataManager.dayDungeonBaseDataDic[key];
                hero.buffController.AttachBuff(hero, data.buffID);
            }

            for (int a = 0; a < hero.buffController.buffList.Count; a++)
            {
                Buff buff = hero.buffController.buffList[a];
                if (buff.baseData.trigger != "OnStartStage")
                {
                    continue;
                }

                if (buff.triggerProbability < UnityEngine.Random.Range(1, 10001))
                {
                    continue;
                }

                BattleUnit target = null;
                if (buff.baseData.triggerTarget == "SkillTarget")
                {
                    target = hero;
                }
                else if (buff.baseData.triggerTarget == "BuffTarget")
                {
                    target = hero;
                }

                if (target && !target.isDie)
                {
                    target.buffController.AttachBuff(hero, buff.baseData.triggerBuff, 1, buff);
                }
            }
        }

        // 전투 시작 시간 체크
        pvpStartTime = Time.time + pvpTime;
        LoadingManager.Close();
        isWin = false;
        //아군 혹은 적군 전부 사망할 때 까지 전투 상태
        while (battlePhase == BattlePhase.Battle)
        {
            if (battleTeamList[0].isAllDie)
            {
                break;
            }

            if (battleTeamList[1].isAllDie)
            {
                isWin = true;
                break;
            }

            pvpReminingTime = pvpStartTime - Time.time;

            if (isGiveUp)
            {
                isWin = false;
                break;
            }

            if (pvpReminingTime <= 0)
            {
                // 남은 체력 비교
                if (CompareHp())
                {
                    isWin = true;
                }
                break;
            }
            yield return(null);
        }

        battlePhase = BattlePhase.Finish;

        //yield return new WaitForSeconds(2f);

        //페이드아웃
        battlePhase = BattlePhase.FadeOut;


        startTime      = Time.time;
        elapsedTime    = 0f;
        fadeOutProcess = 0f;
        while (elapsedTime < battleFadeOutTime)
        {
            fadeOutProcess = elapsedTime / battleFadeOutTime;

            elapsedTime = Time.time - startTime;

            yield return(null);
        }
        fadeOutProcess = 1f;

        if (isWin)
        {
            BattleDayDungeonManager.DayDungeonServerConnect(DayDungeonServerConnectType.BattleResult, ServerResult);
        }
        else
        {
            BattleEnd();
        }

        yield break;
    }