Exemple #1
0
    public void initEnemy(string enemyId)
    {
        UnitId = enemyId;
        SDEnemy e;

        if (GetComponent <SDEnemy>())
        {
            e = GetComponent <SDEnemy>();
        }
        else
        {
            e = gameObject.AddComponent <SDEnemy>();
        }
        EnemyProperty._enemy = e;
        //
        EnemyProperty.ID        = UnitId;
        EnemyProperty._enemy.ID = UnitId;
        //
        EnemyInfo   enemy  = SDDataManager.Instance.getEnemyInfoById(enemyId);
        ROEnemyData d      = SDDataManager.Instance.getEnemyDataById(enemyId);
        int         career = 0;

        if (rareWeight > 0)
        {
            career = UnityEngine.Random.Range(0, (int)Job.End);
        }
        d = enemyBuild.AddCareerData(d, career);
        //
        RoleAttributeList ral = enemyBuild.RALAddedByLevel(enemy.RAL).Clone;
        //
        float scale = SDConstants.HERO_MODEL_RATIO;

        if (isLittleBoss)
        {
            scale = SDConstants.HERO_MODEL_BIG_RATIO;
            d     = enemyBuild.LittleBossData(d, enemy.EnemyRank.Index);
        }
        //
        unit_character_model.initEnemyCharacterModel(UnitId, scale);
        //
        ral.AffectedByRate(d.RALRate);
        //
        EnemyProperty._enemy.initData(enemy.EnemyRank.Index, ral
                                      , d.CRIDmg, d.DmgReduction
                                      , d.DmgReflection, d.dropCoins, d.BarChartRegendPerTurn
                                      , enemy.ID, enemy.Name, 0);
        enemyBuild EB = FindObjectOfType <enemyBuild>();

        if (EB)
        {
            List <OneSkill> skills = EB.WriteEnemySkills(enemy);
            if (skills != null)
            {
                for (int i = 0; i < skills.Count; i++)
                {
                    _skills.Add(skills[i]);
                }
            }
        }
    }
Exemple #2
0
    public static ROEnemyData AddCareerData(ROEnemyData basicData, int career)
    {
        ROEnemyData h = basicData;

        if (career == 0)//fighter
        {
            h.DmgReduction += 10;
            h.RALRate.AT   += 15;
            h.RALRate.AD   += 25;
        }
        else if (career == 1)//ranger
        {
            h.RALRate     += 25;
            h.RALRate.AT  += 25;
            h.RALRate.Evo += 50;
        }
        else if (career == 2)//priest
        {
            h.RALRate.Hp += 30;
            h.RALRate.MT += 10;
            h.RALRate.MD += 10;
        }
        else if (career == 3)//caster
        {
            h.RALRate        += 25;
            h.RALRate.MT     += 25;
            h.RALRate.MD     += 15;
            h.RALRate.Expect += 10;
        }
        return(h);
    }
Exemple #3
0
    public void UpdateKillAmount(string id)
    {
        bool flag = false;

        //
        if (ObjectiveType == KillObjectiveType.Any)
        {
            flag = true;
        }
        else if (ObjectiveType == KillObjectiveType.Race)
        {
            ROEnemyData ED = SDDataManager.Instance.getEnemyDataById(id);
            if (ED.Info.Race.Contains(Race))
            {
                flag = true;
            }
        }
        else if (ObjectiveType == KillObjectiveType.Rank)
        {
            ROEnemyData ED = SDDataManager.Instance.getEnemyDataById(id);
            if (ED.Info.EnemyRank == EnemyRank)
            {
                flag = true;
            }
        }
        else if (ObjectiveType == KillObjectiveType.Specific)
        {
            ROEnemyData ED = SDDataManager.Instance.getEnemyDataById(id);
            if (Enemy != null && ED.Info.ID == Enemy.ID)
            {
                flag = true;
            }
            else if (Enemy == null && ED.Info.ID == EnemyID)
            {
                flag = true;
            }
        }
        //
        if (flag)
        {
            UpdateAmountUp();
        }
    }
Exemple #4
0
    public static ROEnemyData LittleBossData(ROEnemyData basicD, int bossQuality)
    {
        ROEnemyData h = basicD;

        h.RALRate.AddAll(75 * bossQuality + 100, RoleAttributeList.AddType.barChart);
        h.RALRate.Add(75 * bossQuality + 75, AttributeData.AT);
        h.RALRate.Add(75 * bossQuality + 75, AttributeData.AD);
        h.RALRate.Add(75 * bossQuality + 75, AttributeData.MT);
        h.RALRate.Add(75 * bossQuality + 75, AttributeData.MD);
        h.RALRate.Add(50 * bossQuality + 50, AttributeData.Crit);
        h.RALRate.Add(25 * bossQuality + 50, AttributeData.Expect);
        h.RALRate.Add(25 * bossQuality + 50, AttributeData.Evo);
        h.RALRate.Add(25 * bossQuality + 50, AttributeData.Accur);
        h.RALRate.AddAll(50 * bossQuality + 75, RoleAttributeList.AddType.resist);

        h.DmgReduction  = 5;
        h.DmgReflection = 5;

        h.BarChartRegendPerTurn     = RoleBarChart.zero;
        h.BarChartRegendPerTurn.MP += h.BarChartRegendPerTurn.MP / 25;
        return(h);
    }
Exemple #5
0
    //单位死亡逻辑处理
    public IEnumerator IEDie()
    {
        bool showNextUnitFlag = false;

        if (_Tag == SDConstants.CharacterType.Hero)
        {
            BM.Remaining_SRL.Remove(this);
        }
        else
        {
            BM.Remaining_ORL.Remove(this);
            gameObject.tag   = "Untagged";
            showNextUnitFlag = BM.CheckBattleSuccess();
        }
        clearAllStates();

        yield return(new WaitForSeconds(DAMAGE_ANIM_TIME));

        Debug.Log(transform.name + " die.");
        #region 死亡动画
        if (unit_character_model && unit_character_model.CurrentCharacterModel)
        {
            if (_Tag == SDConstants.CharacterType.Hero)
            {
                unit_character_model
                .CurrentCharacterModel.ChangeModelAnim
                    (unit_character_model.CurrentCharacterModel.anim_die);
            }
            else if (_Tag == SDConstants.CharacterType.Enemy)
            {
                unit_character_model.CurrentCharacterModel.isEnemy = true;
                if (IsBoss)
                {
                    unit_character_model.CurrentCharacterModel.isBoss = true;
                    //BM.
                }
                unit_character_model
                .CurrentCharacterModel.ChangeModelAnim
                    (unit_character_model.CurrentCharacterModel.anim_die);
                //
                unit_character_model.CurrentCharacterModel.transform
                .DOScale(Vector3.zero, 0.5f).SetEase(Ease.InBack);
            }
            else
            {
                unit_character_model
                .CurrentCharacterModel.ChangeModelAnim
                    (unit_character_model.CurrentCharacterModel.anim_die);
            }
        }
        #endregion
        #region 死亡掉落与结算
        TriggerManager.Instance.WhenUnitDie(this);
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            SDDataManager.Instance.setHeroStatus(unitHashcode
                                                 , (int)SDConstants.HeroSelectType.Dying);//修改状态为濒死
        }
        else
        {
            //掉落获取
            float goldRatio = 1 + (float)(SDDataManager.Instance.getGoldPerc()) / 100;
            float goldR     = ThisBasicRoleProperty().GoldRate *SDGameManager.Instance.goldRate *goldRatio;
            GoldC.showGold(goldR);
            if (IsBoss)
            {
                EnemyProperty.showDropItems();
            }
            else
            {
                EnemyProperty.showDropItem();
            }
            yield return(new WaitForSeconds(REWARD_ANIM_TIME));
        }
        #endregion
        #region 成就记录
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            SDDataManager.Instance.addAchievementDataByType("heroDie");
        }
        else if (_Tag == SDConstants.CharacterType.Enemy)
        {
            string      id   = ThisBasicRoleProperty().ID;
            ROEnemyData data = SDDataManager.Instance.getEnemyDataById(id);
            string      t    = "kill_" + data.Info.EnemyRank.EnemyType.ToString();
            SDDataManager.Instance.addAchievementDataByType(t);
        }
        #endregion
        #region Obj消失
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            gameObject.GetComponent <CanvasGroup>().DOFade(0, 0.3f);
        }
        else
        {
            gameObject.GetComponent <CanvasGroup>().DOFade(0, 0.3f);
        }
        #endregion
        #region 判断游戏是否结束
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            showNextUnitFlag = BM.CheckBattleLose();
            if (!showNextUnitFlag)
            {
                Debug.Log("hero die not lose");
            }
            else
            {
                Debug.Log("hero die then lose");
                BM.ABM.IsWaitingAction = true;
            }
        }
        else
        {
            if (IsBoss)
            {
                EnemyProperty.showDropItems();
            }
            else
            {
                EnemyProperty.showDropItem();
            }

            if (!showNextUnitFlag)
            {
                Debug.Log("enemy die not success");
            }
            else
            {
                Debug.Log("enemy die then success");
                BM.BattleSuccess();
            }
        }
        #endregion
        yield return(new WaitForSeconds(0.2f));

        HpController.gameObject.SetActive(false);
        //
        showDead();
    }
Exemple #6
0
    //单位消失逻辑处理
    public IEnumerator IEFade()
    {
        bool showNextUnitFlag = false;

        if (_Tag == SDConstants.CharacterType.Hero)
        {
            BM.Remaining_SRL.Remove(this);
            clearAllStates();
        }
        else
        {
            BM.Remaining_ORL.Remove(this);
            gameObject.tag   = "Untagged";
            showNextUnitFlag = BM.CheckBattleSuccess();
        }
        yield return(new WaitForSeconds(DAMAGE_ANIM_TIME));

        #region 消失动画
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            unit_character_model
            .CurrentCharacterModel.ChangeModelAnim
                (unit_character_model.CurrentCharacterModel.anim_fade);
        }
        else
        {
            unit_character_model.CurrentCharacterModel.isEnemy = true;
            if (IsBoss)
            {
                unit_character_model.CurrentCharacterModel.isBoss = true;
                //BM.
            }
            unit_character_model
            .CurrentCharacterModel.ChangeModelAnim
                (unit_character_model.CurrentCharacterModel.anim_fade);
        }
        #endregion
        #region  结算
        TriggerManager.Instance.WhenUnitDie(this);
        #endregion
        #region 成就记录
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            SDDataManager.Instance.addAchievementDataByType("heroDie");
        }
        else if (_Tag == SDConstants.CharacterType.Enemy)
        {
            string      id   = ThisBasicRoleProperty().ID;
            ROEnemyData data = SDDataManager.Instance.getEnemyDataById(id);
            string      t    = "kill_" + data.Info.EnemyRank.EnemyType.ToString();
            SDDataManager.Instance.AddKillingDataToAchievement(id);
            SDDataManager.Instance.addAchievementDataByType(t);
        }
        #endregion
        #region Obj消失
        if (_Tag == SDConstants.CharacterType.Hero)
        {
        }
        else
        {
            gameObject.GetComponent <CanvasGroup>().DOFade(0, 0.3f);
        }
        #endregion
        #region 判断游戏是否结束
        if (_Tag == SDConstants.CharacterType.Hero)
        {
            showNextUnitFlag = BM.CheckBattleLose();
            if (!showNextUnitFlag)
            {
                Debug.Log("hero die not lose");
            }
            else
            {
                Debug.Log("hero die then lose");
                BM.ABM.IsWaitingAction = true;
            }
        }
        else
        {
            if (IsBoss)
            {
                EnemyProperty.showDropItems();
            }
            else
            {
                EnemyProperty.showDropItem();
            }

            if (!showNextUnitFlag)
            {
                Debug.Log("enemy die not success");
            }
            else
            {
                Debug.Log("enemy die then success");
                BM.BattleSuccess();
            }
        }
        #endregion
        yield return(new WaitForSeconds(0.2f));

        HpController.gameObject.SetActive(false);
        //
        showDead();
    }