Esempio n. 1
0
 public SoldierWave(SoldierRegion InRegion, ResSoldierWaveInfo InWaveInfo, int InIndex)
 {
     this.Region   = InRegion;
     this.WaveInfo = InWaveInfo;
     this.Index    = InIndex;
     DebugHelper.Assert((this.Region != null) && (InWaveInfo != null));
     this.isCannonNotified = false;
     this.Reset();
 }
Esempio n. 2
0
        private void OnOrganDead(ref GameDeadEventParam prm)
        {
            if (!prm.src || prm.src.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Organ || !prm.atker)
            {
                return;
            }
            ActorRoot      handle       = prm.src.handle;
            OrganWrapper   organWrapper = handle.AsOrgan();
            COM_PLAYERCAMP actorCamp    = prm.atker.handle.TheActorMeta.ActorCamp;

            if (handle.TheStaticData.TheOrganOnlyInfo.DeadEnemySoldier > 0)
            {
                SoldierRegion soldierRegionByRoute = Singleton <BattleLogic> .GetInstance().mapLogic.GetSoldierRegionByRoute(actorCamp, handle.TheStaticData.TheOrganOnlyInfo.AttackRouteID);

                if (soldierRegionByRoute != null)
                {
                    soldierRegionByRoute.SwitchWave(handle.TheStaticData.TheOrganOnlyInfo.DeadEnemySoldier, false);
                }
            }
            if (this._supportHighTowerSoldier && organWrapper.cfgInfo.bOrganType == 4)
            {
                List <PoolObjHandle <ActorRoot> > organActors = Singleton <GameObjMgr> .GetInstance().OrganActors;

                bool flag = true;
                for (int i = 0; i < organActors.get_Count(); i++)
                {
                    PoolObjHandle <ActorRoot> ptr = organActors.get_Item(i);
                    if (ptr && ptr.handle.AsOrgan().cfgInfo.bOrganType == organWrapper.cfgInfo.bOrganType && ptr.handle.TheActorMeta.ActorCamp == handle.TheActorMeta.ActorCamp && !ptr.handle.ActorControl.IsDeadState)
                    {
                        flag = false;
                        break;
                    }
                }
                if (flag)
                {
                    this._soldierAddAttrs[(int)actorCamp].HadAdd     = true;
                    this._soldierAddAttrs[(int)actorCamp].MaxHP      = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(335u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].PhycAttack = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(336u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].PhycDefend = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(338u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].MagcAttack = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(337u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].MagcDefend = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(339u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].DropCoin   = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(340u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].DropExp    = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(341u).dwConfValue;
                    this._soldierAddAttrs[(int)actorCamp].ShapeScale = (int)GameDataMgr.globalInfoDatabin.GetDataByKey(342u).dwConfValue;
                    KillNotify theKillNotify = Singleton <CBattleSystem> .GetInstance().TheKillNotify;

                    Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer();

                    if (theKillNotify != null && hostPlayer != null)
                    {
                        bool     bSrcAllies = hostPlayer.PlayerCamp == actorCamp;
                        KillInfo killInfo   = new KillInfo(KillNotify.building_icon, null, KillDetailInfoType.Info_Type_Destroy_All_Tower, bSrcAllies, false, ActorTypeDef.Invalid, false);
                        theKillNotify.AddKillInfo(ref killInfo);
                    }
                }
            }
        }
Esempio n. 3
0
 public SoldierRegion GetSoldierRegion(COM_PLAYERCAMP camp, int routeID)
 {
     ListView <SoldierRegion> .Enumerator enumerator = this.soldierAreas.GetEnumerator();
     while (enumerator.MoveNext())
     {
         SoldierRegion current = enumerator.get_Current();
         if (current.CampType == camp && current.RouteID == routeID)
         {
             return(current);
         }
     }
     return(null);
 }
Esempio n. 4
0
 public void EnableSoldierRegion(bool bEnable, SoldierRegion inSoldierRegion)
 {
     if ((inSoldierRegion != null) && this.soldierAreas.Contains(inSoldierRegion))
     {
         if (bEnable)
         {
             inSoldierRegion.Startup();
         }
         else
         {
             inSoldierRegion.Stop();
         }
     }
 }
Esempio n. 5
0
 public void EnableSoldierRegion(bool bEnable, SoldierRegion inSoldierRegion)
 {
     if (inSoldierRegion == null || !this.soldierAreas.Contains(inSoldierRegion))
     {
         return;
     }
     if (bEnable)
     {
         inSoldierRegion.Startup();
     }
     else
     {
         inSoldierRegion.Stop();
     }
 }
        public ListView <SoldierRegion> GetSoldierRegionsByCamp(COM_PLAYERCAMP camp)
        {
            ListView <SoldierRegion> listView = new ListView <SoldierRegion>();

            ListView <SoldierRegion> .Enumerator enumerator = this.soldierAreas.GetEnumerator();
            while (enumerator.MoveNext())
            {
                SoldierRegion current = enumerator.Current;
                if (current.CampType == camp)
                {
                    listView.Add(current);
                }
            }
            return(listView);
        }
Esempio n. 7
0
        protected override void OnDead()
        {
            Singleton <CSoundManager> .GetInstance().PostEvent("Set_Theme", null);

            if (base.actor.TheStaticData.TheOrganOnlyInfo.DeadEnemySoldier > 0)
            {
                SoldierRegion soldierRegion = Singleton <BattleLogic> .GetInstance().mapLogic.GetSoldierRegion(base.actor.GiveMyEnemyCamp(), base.actor.TheStaticData.TheOrganOnlyInfo.AttackRouteID);

                if (soldierRegion != null)
                {
                    soldierRegion.SwitchWave(base.actor.TheStaticData.TheOrganOnlyInfo.DeadEnemySoldier);
                }
            }
            base.OnDead();
        }
Esempio n. 8
0
 private void UpdateSoldierRegionAvail(bool bAvailable)
 {
     if (Singleton <BattleLogic> .GetInstance().mapLogic != null && this.RefObjList != null)
     {
         for (int i = 0; i < this.RefObjList.Length; i++)
         {
             GameObject gameObject = this.RefObjList[i];
             if (!(gameObject == null))
             {
                 SoldierRegion component = gameObject.GetComponent <SoldierRegion>();
                 if (!(component == null))
                 {
                     Singleton <BattleLogic> .GetInstance().mapLogic.EnableSoldierRegion(bAvailable, component);
                 }
             }
         }
     }
 }
Esempio n. 9
0

        
Esempio n. 10
0
        public void UpdateLogic(int delta)
        {
            Singleton <SceneManagement> .GetInstance().UpdateDirtyNodes();

            if (!this.m_bSoldierOverNum)
            {
                bool flag  = true;
                int  count = this.soldierAreas.get_Count();
                for (int i = 0; i < count; i++)
                {
                    SoldierRegion soldierRegion = this.soldierAreas.get_Item(i);
                    if (soldierRegion.isStartup)
                    {
                        SoldierSpawnResult soldierSpawnResult = soldierRegion.UpdateLogicSpec(delta);
                        flag &= (soldierSpawnResult != SoldierSpawnResult.ShouldWaitSoldierInterval);
                    }
                }
                if (flag)
                {
                    this.CheckSoldierOverNumUpper();
                }
            }
            else
            {
                this.CheckSoldierOverNumLower();
            }
            int count2 = this.commonSpawnGroups.get_Count();

            for (int j = 0; j < count2; j++)
            {
                CommonSpawnGroup commonSpawnGroup = this.commonSpawnGroups.get_Item(j);
                if (commonSpawnGroup.isStartup)
                {
                    commonSpawnGroup.UpdateLogic(delta);
                }
            }
            for (int k = 0; k < this.spawnGroups.get_Count(); k++)
            {
                SpawnGroup spawnGroup = this.spawnGroups.get_Item(k);
                if (spawnGroup.isStartup)
                {
                    spawnGroup.UpdateLogic(delta);
                }
            }
            int count3 = this.objTriggerMultiMap.get_Count();

            for (int l = 0; l < count3; l++)
            {
                MapWrapper.ObjTriggerKeyValuePair objTriggerKeyValuePair = this.objTriggerMultiMap.get_Item(l);
                GameObject obj = objTriggerKeyValuePair.obj;
                ListView <AreaEventTrigger> triggers = objTriggerKeyValuePair.triggers;
                if (obj != null && obj.activeSelf && (ulong)(Singleton <FrameSynchr> .get_instance().CurFrameNum % 4u) == (ulong)((long)(l % 4)))
                {
                    bool flag2  = false;
                    int  count4 = triggers.get_Count();
                    for (int m = 0; m < count4; m++)
                    {
                        AreaEventTrigger areaEventTrigger = triggers.get_Item(m);
                        if (areaEventTrigger != null && areaEventTrigger.isStartup)
                        {
                            areaEventTrigger.UpdateLogic(delta * 4);
                            flag2 |= areaEventTrigger.bDoDeactivating;
                        }
                    }
                    if (flag2)
                    {
                        for (int n = 0; n < count4; n++)
                        {
                            AreaEventTrigger areaEventTrigger2 = triggers.get_Item(n);
                            if (areaEventTrigger2 != null)
                            {
                                areaEventTrigger2.DoSelfDeactivating();
                            }
                        }
                    }
                }
            }
        }
Esempio n. 11
0
        public void UpdateLogic(int delta)
        {
            Singleton <SceneManagement> .GetInstance().UpdateDirtyNodes();

            if (!this.m_bSoldierOverNum)
            {
                bool flag = true;
                for (int m = 0; m < this.soldierAreas.Count; m++)
                {
                    SoldierRegion region = this.soldierAreas[m];
                    if (region.isStartup)
                    {
                        SoldierSpawnResult result = region.UpdateLogicSpec(delta);
                        flag &= result != SoldierSpawnResult.ShouldWaitSoldierInterval;
                    }
                }
                if (flag)
                {
                    this.CheckSoldierOverNumUpper();
                }
            }
            else
            {
                this.CheckSoldierOverNumLower();
            }
            for (int i = 0; i < this.commonSpawnGroups.Count; i++)
            {
                CommonSpawnGroup group = this.commonSpawnGroups[i];
                if (group.isStartup)
                {
                    group.UpdateLogic(delta);
                }
            }
            for (int j = 0; j < this.spawnGroups.Count; j++)
            {
                SpawnGroup group2 = this.spawnGroups[j];
                if (group2.isStartup)
                {
                    group2.UpdateLogic(delta);
                }
            }
            int count = this.objTriggerMultiMap.Count;

            for (int k = 0; k < count; k++)
            {
                ObjTriggerKeyValuePair      pair     = this.objTriggerMultiMap[k];
                GameObject                  obj2     = pair.obj;
                ListView <AreaEventTrigger> triggers = pair.triggers;
                if (((obj2 != null) && obj2.activeSelf) && ((Singleton <FrameSynchr> .instance.CurFrameNum % 4) == (k % 4)))
                {
                    bool flag2 = false;
                    for (int n = 0; n < triggers.Count; n++)
                    {
                        AreaEventTrigger trigger = triggers[n];
                        if ((trigger != null) && trigger.isStartup)
                        {
                            trigger.UpdateLogic(delta * 4);
                            flag2 |= trigger.bDoDeactivating;
                        }
                    }
                    if (flag2)
                    {
                        for (int num7 = 0; num7 < triggers.Count; num7++)
                        {
                            AreaEventTrigger trigger2 = triggers[num7];
                            if (trigger2 != null)
                            {
                                trigger2.DoSelfDeactivating();
                            }
                        }
                    }
                }
            }
        }
 public SpawnSoldierParam(SoldierRegion sourceRegion)
 {
     this.SourceRegion = sourceRegion;
 }