Beispiel #1
0
        private void StartFight()
        {
            _interlude = false;
            _hangup    = false;
            List <HeroEntity>  heroList  = PlayerController.instance.heros;
            List <EnemyEntity> enemyList = EnemyController.instance.enemies;

            switch (Fight.Controller.FightController.instance.fightType)
            {
            case FightType.PVE:
            case FightType.Arena:
            case FightType.DailyPVE:
            case FightType.Expedition:
            case FightType.WorldTree:
            case FightType.WorldBoss:
            case FightType.PVP:
            case FightType.FriendFight:
            case FightType.MineFight:
#if UNITY_EDITOR
            case FightType.Imitate:
#endif
                SortHitSkill(heroList, enemyList);
                _enemyAutoOrder = true;
                DataMessageHandler.DataMessage_TickCD(true);
                break;

            case FightType.ConsortiaFight:
#if UNITY_EDITOR
                orderSkills.Clear();
                finishSkills.Clear();
#endif
                _enemyAutoOrder = false;
                DataMessageHandler.DataMessage_TickCD(true);
                //StopCoroutine("PVPResultCoroutine");
                OrderConsortiaSkill();
                break;

            case FightType.FirstFight:
            case FightType.SkillDisplay:
                _enemyAutoOrder = false;
                break;
            }
            DataMessageHandler.DataMessage_StartFight();
            HeroEntity hero = null;
            for (int i = 0, count = heroList.Count; i < count; i++)
            {
                hero = heroList[i];
                if (Fight.Model.FightProxy.instance.CurrentTeamIndex == 0)
                {
                    if (Fight.Controller.FightController.instance.fightType == FightType.FirstFight)
                    {
                        FirstFightCharacterData ffcd = MockFightController.instance.GetCharacterDataById((int)hero.characterInfo.instanceID);
                        hero.skill1CD = ffcd.cd1;
                        hero.skill2CD = ffcd.cd2;
                    }
                    else
                    {
                        hero.skill1CD = 0;
                        hero.skill2CD = 0;
                    }
                }
                hero.SetOrderable();
                //Debugger.Log("hero {0},hp {1} ", hero.characterInfo.instanceID, hero.HP);
            }

            EnemyEntity enemy = null;
            for (int i = 0, count = enemyList.Count; i < count; i++)
            {
                enemy          = enemyList[i];
                enemy.skill1CD = 0;
                enemy.skill2CD = 0;
                switch (Fight.Controller.FightController.instance.fightType)
                {
                case FightType.PVE:
                case FightType.DailyPVE:
                case FightType.WorldTree:
                    try
                    {
                        if (Fight.Model.FightProxy.instance.CurrentTeamIndex > 0)
                        {
                            Logic.Team.Model.TeamData teamData = Logic.Fight.Model.FightProxy.instance.GetCurrentTeamData();
                            if (enemy.characterInfo.skillId1 > 0)
                            {
                                enemy.skill1CD = teamData.cdReduceRate * enemy.characterInfo.skillInfo1.skillData.CD;
                            }
                            else
                            {
                                enemy.skill1CD = 0;
                            }
                            if (enemy.characterInfo.skillId2 > 0)
                            {
                                enemy.skill2CD = teamData.cdReduceRate * enemy.characterInfo.skillInfo2.skillData.CD;
                            }
                            else
                            {
                                enemy.skill2CD = 0;
                            }
                        }
                        else
                        {
                            enemy.skill1CD = 0;
                            enemy.skill2CD = 0;
                        }
                    }
                    catch (System.Exception e)
                    {
                        Debugger.Log("set cd fail:" + e.StackTrace);
                        enemy.skill1CD = 0;
                        enemy.skill2CD = 0;
                    }
                    break;

                case FightType.FirstFight:
                    FirstFightCharacterData ffcd = MockFightController.instance.GetCharacterDataById((int)enemy.characterInfo.instanceID);
                    enemy.skill1CD = ffcd.cd1;
                    enemy.skill2CD = ffcd.cd2;
                    break;
                }
                //if (Fight.Controller.FightController.instance.fightType == FightType.FirstFight)
                //{
                //    FirstFightCharacterData ffcd = MockFightController.instance.GetCharacterDataById((int)enemy.characterInfo.instanceID);
                //    enemy.skill1CD = ffcd.cd1;
                //    enemy.skill2CD = ffcd.cd2;
                //}
                //else
                //{
                //    enemy.skill1CD = 0;
                //    enemy.skill2CD = 0;
                //}
                enemy.SetOrderable();
                //Debugger.Log("enemy {0},hp {1} ", enemy.characterInfo.instanceID, enemy.HP);
            }
        }