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); } } } }
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); }
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); } } }