Beispiel #1
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();
        }
Beispiel #2
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);
            }
        }