Example #1
0
        /** 设置生产技能 */
        public void ExeSetProduceSkill(int legionId, int skillUid, float speed)
        {
            LegionData          legionData   = War.GetLegionData(legionId);
            UnitCtl             unitCtl      = War.scene.GetUnitForUID(legionData.unitData.uid);
            BLegionSkillManager skillManager = unitCtl.GetComponent <BLegionSkillManager> ();

            skillManager.SetProduceSkill(skillUid, speed);
        }
Example #2
0
        /** 发兵 */
        public void ExeSendArm(int from, int to, int count, int idBegin)
        {
            UnitCtl     fromUnit   = War.scene.GetBuild(from);
            UnitCtl     toUnit     = War.scene.GetBuild(to);
            BSendArming sendArming = fromUnit.GetComponent <BSendArming>();

            sendArming.ExeSend(toUnit, count, idBegin);

//			Debug.Log ("S_SendArm sendArming=" + sendArming);
        }
Example #3
0
        /** 箭塔攻击 */
        public void ExeTurret(int buildId, int soliderId)
        {
            UnitCtl build   = War.scene.GetUnitForUID(buildId);
            UnitCtl solider = War.scene.GetUnitForUID(soliderId);

            if (build != null && solider != null)
            {
                BTurret turret = build.GetComponent <BTurret>();
                turret.ExeAtk(solider);
            }
        }
Example #4
0
        /** 兵营改变势力 */
        public void OnBuildChangeLegion(UnitData buildUnitData, int preLegionId, int targetLegionId)
        {
            // 强制更新兵营所属势力
            updateBuildLegion.Execute();

            if (preLegionId == targetLegionId)
            {
                Debug.Log("<color=red>preLegionId == targetLegionId</color>");
            }

            // 攻占方势力数据
            LegionData targetLegionData = War.GetLegionData(targetLegionId);

            UnitCtl heroUnit = GetHeroByBuild(buildUnitData.unit);

            if (heroUnit != null)
            {
                // 英雄数据
                HeroData heroData = heroUnit.heroData;
                // 英雄行为
                BHero heroBehaviour = heroUnit.GetComponent <BHero>();
                //
                int legionId = heroUnit.unitData.legionId;

                // ---如果状态是幕前
                if (heroData.state == HeroState.Foregstage)
                {
//					KillHero(heroUnit, targetLegionData);

                    if (War.requireSynch)
                    {
                        if (War.IsSendService(targetLegionData.legionId, targetLegionData.type))
                        {
                            War.service.C_SyncHeroBackstage_0x828(heroUnit.unitData.uid, targetLegionId);
                        }
                    }
                    else
                    {
                        KillHero(heroUnit, targetLegionData);
                    }
                }
            }
            else
            {
//				// 添加经验--占领
//				targetLegionData.levelData.AddExp_Build();
            }

            War.signal.BuildChangeLegionComplete();
        }
        IEnumerator GotoBuildSoonEnd(SkillParameter skillParameter, EffectParameter effectParameter)
        {
            yield return(new WaitForSeconds(1.0f));

            UnitCtl unit = effectParameter.unitCtlList[0];
            //SkillWarConf skillWarConf = War.model.GetSkillWarConf(skillParameter.skillId);

            UnitCtl curUnit = War.scene.GetUnitForUID(effectParameter.curBuildUid);

            if (curUnit != null)
            {
                curUnit.GetComponent <BSendArming>().Send(unit, (int)effectParameter.value, 20.0f);
            }
            Debug.Log(string.Format("<color=yellow> GotoBuildSoon to {0} {1}</color>",
                                    unit.unitData.id, effectParameter.value));
        }
Example #6
0
        //伤害单个
        IEnumerator autoHurtBuildAllHurtSingle(SkillParameter skillParameter, EffectParameter effectInfo, UnitCtl unit, bool needDealSkill2)
        {
            yield return(new WaitForSeconds(0));

            int lengion = War.skillWarManager.getLegionByHeroUid(skillParameter.curHeroUid);

            if (lengion == unit.unitData.legionId)
            {
                yield break;
            }
            float hurtValue = effectInfo.value;

            if (effectInfo.effect.type == (int)eSKillWarEffectType.eEffectHurtBuidingMax)
            {
                hurtValue = unit.unitData.maxHp * effectInfo.value / 100;
            }
            else if (effectInfo.effect.type == (int)eSKillWarEffectType.eEffectHurtRate)
            {
                Debug.LogFormat("=================hp:{0} value:{1}", unit.unitData.hp, effectInfo.value);
                hurtValue = unit.unitData.hp * effectInfo.value / 100;
            }
            DamageVO damageVo = War.skillWarManager.GetDamageParameter(hurtValue, false, DamageType.ATTACK, unit, effectInfo.caster);

            unit.Damage(damageVo, 0f, 0.2f, effectInfo.effect.hurtCount);
            //War.skillWarManager.soldierDieSHow(unit);

            //处理技能2
            if (needDealSkill2 == true && skillParameter.curDealSkillIdx == 1)
            {
                Debug.LogFormat("=====needDealSkill2 true=====");
                War.skillWarManager.dealSkill2Effect(skillParameter);
            }

            if (effectInfo.effect.time > 0)
            {
                //War.skillWarManager.StartCoroutine(autoHurtBuildAllTimer(skillParameter, unit));
                BuildSkillDots skillDots = unit.GetComponent <BuildSkillDots>();
                if (skillDots != null)
                {
                    skillDots.GetSkillHurt(effectInfo);
                }
            }
            Debug.Log(string.Format("<color=yellow> autoHurtBuildAllHurtSingle all=skill id:{0}, lvl:{1} v:{2}  effecttime:{3}</color>",
                                    skillParameter.skillId, skillParameter.skillLvl, effectInfo.value, effectInfo.effect.time));
        }
        IEnumerator effectDispelEnd(SkillParameter skillParameter, EffectParameter effectParameter)
        {
            yield return(new WaitForSeconds(0.5f));

            UnitCtl curUnit        = War.scene.GetUnitForUID(effectParameter.curBuildUid);
            float   sendCountTatal = curUnit.unitData.hp * effectParameter.value / 100;
            int     countBuild     = effectParameter.unitCtlList.Count;

            if (countBuild > 0)
            {
                float sendCount = sendCountTatal / countBuild;
                foreach (UnitCtl unit in effectParameter.unitCtlList)
                {
                    Debug.Log("sendto " + unit.unitData.id + " count: " + sendCount);
                    curUnit.GetComponent <BSendArming>().Send(unit, (int)sendCount, 10.0f);
                }
            }
            Debug.Log(string.Format("<color=yellow> effectDispelEnd to {0} {1}</color>",
                                    curUnit.unitData.id, sendCountTatal));
        }
Example #8
0
        public void KillHero(UnitCtl heroUnit, LegionData targetLegionData)
        {
            // 英雄数据
            HeroData heroData = heroUnit.heroData;
            // 英雄行为
            BHero heroBehaviour = heroUnit.GetComponent <BHero>();

            // ---如果状态是幕前
            if (heroData.state == HeroState.Foregstage)
            {
                // 添加经验--击杀英雄
                targetLegionData.levelData.AddExp_KillHero(heroUnit);
                // 幕后
                heroBehaviour.Backstage();

                War.msgBox.Show_KillHero(targetLegionData, heroData);


                Coo.soundManager.PlaySound("effect_hero_dead");

                War.signal.DoHeroBackstage(heroUnit.unitData.uid, targetLegionData.legionId);
            }
        }