private SoldierWave FindNextValidWave()
        {
            if (this.CurrentWave == null)
            {
                this.CurrentWave = ((this.Waves.Count > 0) ? this.Waves[0] : null);
            }
            else
            {
                this.CurrentWave = ((this.CurrentWave.Index < this.Waves.Count - 1) ? this.Waves[this.CurrentWave.Index + 1] : null);
            }
            if (this.CurrentWave != null && this._lastWave != null)
            {
                this.CurrentWave.ContinueState(this._lastWave);
                this._lastWave = null;
            }
            int inWaveIndex = (this.CurrentWave != null) ? this.CurrentWave.Index : (this.Waves.Count - 1);
            SoldierWaveParam soldierWaveParam = new SoldierWaveParam(inWaveIndex, 0, this.GetNextRepeatTime(true), this.CurrentWave);

            Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNext, ref soldierWaveParam);

            return(this.CurrentWave);
        }
Ejemplo n.º 2
0
 private SoldierWave FindNextValidWave()
 {
     if (this.CurrentWave == null)
     {
         this.CurrentWave = (this.Waves.Count <= 0) ? null : this.Waves[0];
     }
     else
     {
         this.CurrentWave = (this.CurrentWave.Index >= (this.Waves.Count - 1)) ? null : this.Waves[this.CurrentWave.Index + 1];
     }
     if ((this.CurrentWave != null) && (this._lastWave != null))
     {
         this.CurrentWave.CloneState(this._lastWave);
         this._lastWave = null;
     }
     if (this.bTriggerEvent)
     {
         int inWaveIndex      = (this.CurrentWave == null) ? (this.Waves.Count - 1) : this.CurrentWave.Index;
         SoldierWaveParam prm = new SoldierWaveParam(inWaveIndex, 0, this.GetNextRepeatTime(true));
         Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNext, ref prm);
     }
     return(this.CurrentWave);
 }
Ejemplo n.º 3
0
 private SoldierWave FindNextValidWave()
 {
     if (this.CurrentWave == null)
     {
         this.CurrentWave = ((this.Waves.get_Count() <= 0) ? null : this.Waves.get_Item(0));
     }
     else
     {
         this.CurrentWave = ((this.CurrentWave.Index >= this.Waves.get_Count() - 1) ? null : this.Waves.get_Item(this.CurrentWave.Index + 1));
     }
     if (this.CurrentWave != null && this._lastWave != null)
     {
         this.CurrentWave.CloneState(this._lastWave);
         this._lastWave = null;
     }
     if (this.bTriggerEvent)
     {
         int inWaveIndex = (this.CurrentWave == null) ? (this.Waves.get_Count() - 1) : this.CurrentWave.Index;
         SoldierWaveParam soldierWaveParam = new SoldierWaveParam(inWaveIndex, 0, this.GetNextRepeatTime(true));
         Singleton <GameEventSys> .get_instance().SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNext, ref soldierWaveParam);
     }
     return(this.CurrentWave);
 }
Ejemplo n.º 4
0
        private void SpawnSoldier(uint SoldierID)
        {
            ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff((int)SoldierID);

            if (dataCfgInfoByCurLevelDiff == null)
            {
                return;
            }
            string     path      = StringHelper.UTF8BytesToString(ref dataCfgInfoByCurLevelDiff.szCharacterInfo);
            CActorInfo actorInfo = CActorInfo.GetActorInfo(path, enResourceType.BattleScene);

            if (actorInfo)
            {
                Transform      transform  = this.Region.transform;
                COM_PLAYERCAMP campType   = this.Region.CampType;
                ActorMeta      actorMeta  = default(ActorMeta);
                ActorMeta      actorMeta2 = actorMeta;
                actorMeta2.ConfigId  = (int)SoldierID;
                actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster;
                actorMeta2.ActorCamp = campType;
                actorMeta            = actorMeta2;
                VInt3 vInt  = (VInt3)transform.position;
                VInt3 vInt2 = (VInt3)transform.forward;
                PoolObjHandle <ActorRoot> poolObjHandle = default(PoolObjHandle <ActorRoot>);
                if (!Singleton <GameObjMgr> .GetInstance().TryGetFromCache(ref poolObjHandle, ref actorMeta))
                {
                    poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, vInt, vInt2, false, true);

                    if (poolObjHandle)
                    {
                        poolObjHandle.handle.InitActor();
                        poolObjHandle.handle.PrepareFight();
                        Singleton <GameObjMgr> .instance.AddActor(poolObjHandle);

                        poolObjHandle.handle.StartFight();
                    }
                }
                else
                {
                    ActorRoot handle = poolObjHandle.handle;
                    handle.TheActorMeta.ActorCamp = actorMeta.ActorCamp;
                    handle.ReactiveActor(vInt, vInt2);
                }
                if (poolObjHandle)
                {
                    if (this.Region.AttackRoute != null)
                    {
                        poolObjHandle.handle.ActorControl.AttackAlongRoute(this.Region.AttackRoute.GetComponent <WaypointsHolder>());
                    }
                    else if (this.Region.finalTarget != null)
                    {
                        FrameCommand <AttackPositionCommand> frameCommand = FrameCommandFactory.CreateFrameCommand <AttackPositionCommand>();
                        frameCommand.cmdId            = 1u;
                        frameCommand.cmdData.WorldPos = new VInt3(this.Region.finalTarget.transform.position);
                        poolObjHandle.handle.ActorControl.CmdAttackMoveToDest(frameCommand, frameCommand.cmdData.WorldPos);
                    }
                    if (!this.isCannonNotified && this.WaveInfo.bType == 1 && this.Region != null && (this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_MID || this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_NONE))
                    {
                        KillNotify theKillNotify = Singleton <CBattleSystem> .GetInstance().TheKillNotify;

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

                        if (theKillNotify != null && hostPlayer != null)
                        {
                            bool flag = hostPlayer.PlayerCamp == poolObjHandle.handle.TheActorMeta.ActorCamp;
                            if (flag)
                            {
                                KillInfo killInfo = new KillInfo((hostPlayer.PlayerCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? KillNotify.blue_cannon_icon : KillNotify.red_cannon_icon, null, KillDetailInfoType.Info_Type_Cannon_Spawned, flag, false, ActorTypeDef.Invalid, false);
                                theKillNotify.AddKillInfo(ref killInfo);
                                this.isCannonNotified = true;
                            }
                        }
                    }
                    if (this.WaveInfo.bType == 2)
                    {
                        if (!this.isNotifiedBigDragonSoldier && this.Region != null && (this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_MID || this.Region.RouteType == RES_SOLDIER_ROUTE_TYPE.RES_SOLDIER_ROUTE_NONE))
                        {
                            KillNotify theKillNotify2 = Singleton <CBattleSystem> .GetInstance().TheKillNotify;

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

                            if (theKillNotify2 != null && hostPlayer2 != null)
                            {
                                bool     bSrcAllies = hostPlayer2.PlayerCamp == poolObjHandle.handle.TheActorMeta.ActorCamp;
                                KillInfo killInfo2  = new KillInfo(KillNotify.soldier_bigdragon_icon, null, KillDetailInfoType.Info_Type_Soldier_BigDragon, bSrcAllies, false, ActorTypeDef.Invalid, false);
                                theKillNotify2.AddKillInfo(ref killInfo2);
                                this.isNotifiedBigDragonSoldier = true;
                            }
                        }
                    }
                    else if (this.isNotifiedBigDragonSoldier)
                    {
                        this.isNotifiedBigDragonSoldier = false;
                    }
                }
            }
            SoldierWaveParam soldierWaveParam = new SoldierWaveParam(this.Index, this.repeatCount, this.Region.GetNextRepeatTime(false), this);

            Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNextRepeat, ref soldierWaveParam);
        }
Ejemplo n.º 5
0
        private void SpawnSoldier(uint SoldierID)
        {
            ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff((int)SoldierID);

            if (dataCfgInfoByCurLevelDiff != null)
            {
                if (CActorInfo.GetActorInfo(StringHelper.UTF8BytesToString(ref dataCfgInfoByCurLevelDiff.szCharacterInfo), enResourceType.BattleScene) != null)
                {
                    Transform      transform = this.Region.transform;
                    COM_PLAYERCAMP campType  = this.Region.CampType;
                    ActorMeta      actorMeta = new ActorMeta {
                        ConfigId  = (int)SoldierID,
                        ActorType = ActorTypeDef.Actor_Type_Monster,
                        ActorCamp = campType
                    };
                    VInt3 position = (VInt3)transform.position;
                    VInt3 forward  = (VInt3)transform.forward;
                    PoolObjHandle <ActorRoot> actor = new PoolObjHandle <ActorRoot>();
                    if (!Singleton <GameObjMgr> .GetInstance().TryGetFromCache(ref actor, ref actorMeta))
                    {
                        actor = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, position, forward, false, true);

                        if (actor != 0)
                        {
                            actor.handle.InitActor();
                            actor.handle.PrepareFight();
                            Singleton <GameObjMgr> .instance.AddActor(actor);

                            actor.handle.StartFight();
                        }
                    }
                    else
                    {
                        ActorRoot handle = actor.handle;
                        handle.TheActorMeta.ActorCamp = actorMeta.ActorCamp;
                        handle.ReactiveActor(position, forward);
                    }
                    if (actor != 0)
                    {
                        if (this.Region.AttackRoute != null)
                        {
                            actor.handle.ActorControl.AttackAlongRoute(this.Region.AttackRoute.GetComponent <WaypointsHolder>());
                        }
                        else if (this.Region.finalTarget != null)
                        {
                            FrameCommand <AttackPositionCommand> cmd = FrameCommandFactory.CreateFrameCommand <AttackPositionCommand>();
                            cmd.cmdId            = 1;
                            cmd.cmdData.WorldPos = new VInt3(this.Region.finalTarget.transform.position);
                            actor.handle.ActorControl.CmdAttackMoveToDest(cmd, cmd.cmdData.WorldPos);
                        }
                        if (!this.isCannonNotified && (this.WaveInfo.bType == 1))
                        {
                            KillNotify killNotifation = Singleton <CBattleSystem> .GetInstance().GetKillNotifation();

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

                            if ((killNotifation != null) && (hostPlayer != null))
                            {
                                bool bSrcAllies = hostPlayer.PlayerCamp == actor.handle.TheActorMeta.ActorCamp;
                                if (bSrcAllies)
                                {
                                    KillInfo killInfo = new KillInfo((hostPlayer.PlayerCamp != COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? KillNotify.red_cannon_icon : KillNotify.blue_cannon_icon, null, KillDetailInfoType.Info_Type_Cannon_Spawned, bSrcAllies, false, ActorTypeDef.Invalid);
                                    killNotifation.AddKillInfo(killInfo);
                                    this.isCannonNotified = true;
                                }
                            }
                        }
                    }
                }
                if (this.Region.bTriggerEvent)
                {
                    SoldierWaveParam prm = new SoldierWaveParam(this.Index, this.repeatCount, this.Region.GetNextRepeatTime(false));
                    Singleton <GameEventSys> .instance.SendEvent <SoldierWaveParam>(GameEventDef.Event_SoldierWaveNextRepeat, ref prm);
                }
            }
        }