public static void BuildAndInstantiate(MonsterFactoryOpts opts) { var monsterObj = GameObject.Find(opts.MonsterUid); if (monsterObj == null) { monsterObj = new GameObject(opts.MonsterUid); monsterObj.transform.localScale = new Vector3(100, 100); FactoryMethods.AddCollider(monsterObj); var spriteRenderer = monsterObj.AddComponent <SpriteRenderer>(); var spriteSheet = monsterObj.AddComponent <SpriteSheet>(); spriteRenderer.sortingOrder = 2; var bodySprite = AssetHandler.LoadedAssets[DefaultAssets.SPR_MONTERS_1]; var spriteRow = bodySprite.SliceRow(opts.SpriteIndex).ToArray(); spriteSheet.SetSheet(spriteRow, rowSize: 2); spriteRenderer.sprite = spriteSheet.WalkSouth[1]; var movingBehaviour = monsterObj.AddComponent <MovingEntityBehaviour>(); movingBehaviour.SpriteSheets.Add(spriteSheet); movingBehaviour.MoveSpeed = opts.MoveSpeed; movingBehaviour.MapPosition = opts.Position; var monsterEntityWrapper = new MonsterWrapper() { MonsterObj = monsterObj }; movingBehaviour.EntityWrapper = monsterEntityWrapper; monsterObj.transform.position = new Vector2(opts.Position.X * 16, -opts.Position.Y * 16); UnityClient.Map.EntityPositions.AddEntity(monsterEntityWrapper, opts.Position); } }
private void FilterActorType(PoolObjHandle <ActorRoot> actorObj) { if (this.bFilterHero && (actorObj.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)) { this.bCheckFilter = false; } else { if (this.bFilterMonter) { MonsterWrapper wrapper = actorObj.handle.AsMonster(); if (((wrapper != null) && (wrapper.cfgInfo != null)) && (wrapper.cfgInfo.bMonsterGrade != 3)) { this.bCheckFilter = false; return; } } if (this.bFilterBoss) { MonsterWrapper wrapper2 = actorObj.handle.AsMonster(); if (((wrapper2 != null) && (wrapper2.cfgInfo != null)) && (wrapper2.cfgInfo.bMonsterGrade == 3)) { this.bCheckFilter = false; return; } } if (this.bFilterOrgan && (actorObj.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ)) { this.bCheckFilter = false; } } }
private void MonsterGetHostHero(ref PoolObjHandle <ActorRoot> srcActor, ref PoolObjHandle <ActorRoot> tempActor) { if (!srcActor || srcActor.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Monster) { return; } MonsterWrapper monsterWrapper = srcActor.handle.ActorControl as MonsterWrapper; if (monsterWrapper != null && monsterWrapper.isCalledMonster) { tempActor = monsterWrapper.GetOrignalActor(); } }
private void SpawnMonster(Action _action) { ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff(this.ConfigID); if (dataCfgInfoByCurLevelDiff == null) { return; } string fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfoByCurLevelDiff.szCharacterInfo) + ".asset"; CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo; if (exists) { ActorMeta actorMeta = default(ActorMeta); ActorMeta actorMeta2 = actorMeta; actorMeta2.ConfigId = this.ConfigID; actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster; actorMeta2.ActorCamp = this.PlayerCamp; actorMeta2.EnCId = this.ConfigID; actorMeta = actorMeta2; VInt3 location = this.tarActor.handle.location; VInt3 forward = this.tarActor.handle.forward; PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (poolObjHandle) { poolObjHandle.handle.InitActor(); poolObjHandle.handle.PrepareFight(); Singleton <GameObjMgr> .instance.AddActor(poolObjHandle); poolObjHandle.handle.StartFight(); poolObjHandle.handle.ObjLinker.Invincible = this.Invincible; poolObjHandle.handle.ObjLinker.CanMovable = this.Moveable; MonsterWrapper monsterWrapper = poolObjHandle.handle.ActorControl as MonsterWrapper; if (monsterWrapper != null) { if (this.wayPoint != null) { monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { monsterWrapper.LifeTime = this.LifeTime; } } } } }
public void OnBaronAttacked(MonsterWrapper InBaron, ActorRoot InAtacker) { if (!this.bIsClassic5V5Mode || !InAtacker.IsHostCamp()) { return; } bool isAttacked = InBaron.m_isAttacked; if (!this.bIsBaronActived && isAttacked) { this.PlayBattleEvent("Play_Music_Dalong_S1"); this.BaronActor = InBaron.GetActor(); this.bIsBaronActived = true; this.RegistBaronEvents(); } }
public static void BuildAndInstantiate(MonsterFactoryOpts opts) { var monsterObj = GameObject.Find(opts.Packet.MonsterUid); if (monsterObj == null) { monsterObj = new GameObject(opts.Packet.MonsterUid); monsterObj.transform.localScale = new Vector3(100, 100); var spriteObj = new GameObject("Sprites_" + opts.Packet.MonsterUid); spriteObj.transform.localScale = new Vector3(100, 100); var spriteRenderer = spriteObj.AddComponent <SpriteRenderer>(); var spriteSheet = spriteObj.AddComponent <SpriteSheet>(); spriteRenderer.sortingOrder = 2; var bodySprite = AssetHandler.LoadedAssets[DefaultAssets.SPR_MONTERS_1]; var spriteRow = bodySprite.SliceRow(opts.Packet.SpriteIndex).ToArray(); spriteSheet.SetSheet(spriteRow, rowSize: 2); spriteRenderer.sprite = spriteSheet.WalkSouth[1]; spriteObj.transform.parent = monsterObj.transform; // Moving Entity var livingEntityBhv = monsterObj.AddComponent <LivingEntityBehaviour>(); livingEntityBhv.SpriteSheets.Add(spriteSheet); var monsterEntityWrapper = new MonsterWrapper() { MonsterObj = monsterObj, EntityType = EntityType.MONSTER, MoveSpeed = opts.Packet.MoveSpeed, UID = opts.Packet.MonsterUid, Position = opts.Position, Atk = opts.Packet.Atk, Def = opts.Packet.Def, HP = opts.Packet.HP, MAXHP = opts.Packet.MAXHP }; monsterObj.transform.parent = UnityExtensions.GetEntitiesContainer().transform; livingEntityBhv.Entity = monsterEntityWrapper; monsterObj.transform.position = opts.Position.ToUnityPosition(); UnityClient.Map.UpdateEntityPosition(monsterEntityWrapper, null, opts.Position); FactoryMethods.AddCollider(monsterObj); FactoryMethods.AddHealthBar(monsterObj); } }
private void onMonsterGroupDead(ref GameDeadEventParam param) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "Master Roleinfo is NULL!"); if (masterRoleInfo == null) { return; } if (param.src) { if (param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { MonsterWrapper monsterWrapper = param.src.handle.AsMonster(); DebugHelper.Assert(monsterWrapper != null && monsterWrapper.cfgInfo != null, "Can't find Monster config -- ID: {0}", new object[] { param.src.handle.TheActorMeta.ConfigId }); if (monsterWrapper.cfgInfo == null || monsterWrapper.cfgInfo.bMonsterType == 1) { return; } } if (param.atker && ActorHelper.IsHostActor(ref param.atker)) { if (Singleton <BattleLogic> .GetInstance().DragonId != 0 && param.src.handle.TheActorMeta.ConfigId == Singleton <BattleLogic> .GetInstance().DragonId) { if (!masterRoleInfo.IsNewbieAchieveSet(4)) { Singleton <CNewbieAchieveSys> .GetInstance().ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_LITTLEDRAGON); masterRoleInfo.SetNewbieAchieve(4, true, false); } } else if (!masterRoleInfo.IsNewbieAchieveSet(3)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_DESTORY_MONSTERHOME); masterRoleInfo.SetNewbieAchieve(3, true, false); } } } }
private void FilterActorType(PoolObjHandle <ActorRoot> actorObj) { if (this.bFilterHero && actorObj.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { this.bCheckFilter = false; return; } if (this.bFilterMonter) { MonsterWrapper monsterWrapper = actorObj.get_handle().AsMonster(); if (monsterWrapper != null && monsterWrapper.cfgInfo != null && monsterWrapper.cfgInfo.bMonsterGrade != 3) { this.bCheckFilter = false; return; } } if (this.bFilterBoss) { MonsterWrapper monsterWrapper2 = actorObj.get_handle().AsMonster(); if (monsterWrapper2 != null && monsterWrapper2.cfgInfo != null && monsterWrapper2.cfgInfo.bMonsterGrade == 3) { this.bCheckFilter = false; return; } } if (this.bFilterOrgan && actorObj.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { this.bCheckFilter = false; return; } if (this.bFilterEye && actorObj.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE) { this.bCheckFilter = false; return; } }
public static KillInfo Convert_DetailInfo_KillInfo(KillDetailInfo detail) { KillDetailInfoType killDetailInfoType = KillDetailInfoType.Info_Type_None; PoolObjHandle <ActorRoot> killer = detail.Killer; PoolObjHandle <ActorRoot> victim = detail.Victim; bool flag = false; bool flag2 = false; bool flag3 = false; if (killer) { flag = (killer.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ); flag2 = (killer.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster); flag3 = (killer.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero); } KillInfo result = default(KillInfo); result.KillerImgSrc = (result.VictimImgSrc = string.Empty); result.MsgType = detail.Type; result.bPlayerSelf_KillOrKilled = detail.bPlayerSelf_KillOrKilled; result.actorType = ((!killer) ? ActorTypeDef.Invalid : killer.get_handle().TheActorMeta.ActorType); result.bSrcAllies = detail.bSelfCamp; result.assistImgSrc = new string[4]; if (flag2) { result.KillerImgSrc = KillNotify.monster_icon; } if (flag) { result.KillerImgSrc = KillNotify.building_icon; } if (flag3) { result.KillerImgSrc = KillNotifyUT.GetHero_Icon(detail.Killer, false); } if (killer) { if (killer.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { result.KillerImgSrc = KillNotify.building_icon; } if (killer.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { MonsterWrapper monsterWrapper = killer.get_handle().AsMonster(); if (killer.get_handle().TheActorMeta.ConfigId == Singleton <BattleLogic> .get_instance().DragonId) { result.KillerImgSrc = KillNotify.dragon_icon; } else if (monsterWrapper.cfgInfo != null && monsterWrapper.cfgInfo.bMonsterType == 2) { result.KillerImgSrc = KillNotify.yeguai_icon; } else { result.KillerImgSrc = KillNotify.monster_icon; } } if (killer.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { result.KillerImgSrc = KillNotifyUT.GetHero_Icon(killer, false); } } if (victim) { if (victim.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { result.VictimImgSrc = KillNotifyUT.GetHero_Icon(victim, false); } if (victim.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { result.VictimImgSrc = KillNotify.building_icon; } if (victim.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster && victim.get_handle().TheActorMeta.ConfigId == Singleton <BattleLogic> .get_instance().DragonId) { result.VictimImgSrc = KillNotify.dragon_icon; } } if (detail.assistList != null && result.assistImgSrc != null) { for (int i = 0; i < detail.assistList.get_Count(); i++) { uint num = detail.assistList.get_Item(i); for (int j = 0; j < Singleton <GameObjMgr> .get_instance().HeroActors.get_Count(); j++) { if (num == Singleton <GameObjMgr> .get_instance().HeroActors.get_Item(j).get_handle().ObjID) { result.assistImgSrc[i] = KillNotifyUT.GetHero_Icon(Singleton <GameObjMgr> .get_instance().HeroActors.get_Item(j), false); } } } } if (detail.Type == KillDetailInfoType.Info_Type_Soldier_Boosted) { result.KillerImgSrc = ((!detail.bSelfCamp) ? KillNotify.red_soldier_icon : KillNotify.blue_soldier_icon); return(result); } if (detail.Type == KillDetailInfoType.Info_Type_Reconnect || detail.Type == KillDetailInfoType.Info_Type_RunningMan) { result.VictimImgSrc = string.Empty; return(result); } if (detail.HeroMultiKillType != killDetailInfoType) { result.MsgType = detail.HeroMultiKillType; return(result); } if (detail.Type == KillDetailInfoType.Info_Type_StopMultiKill) { return(result); } if (detail.Type == KillDetailInfoType.Info_Type_First_Kill) { return(result); } if (detail.Type == KillDetailInfoType.Info_Type_DestroyTower) { return(result); } if (detail.Type == KillDetailInfoType.Info_Type_Kill_3V3_Dragon || detail.Type == KillDetailInfoType.Info_Type_Kill_5V5_SmallDragon || detail.Type == KillDetailInfoType.Info_Type_Kill_5V5_BigDragon) { if (flag2) { result.KillerImgSrc = KillNotify.monster_icon; } if (flag) { result.KillerImgSrc = KillNotify.building_icon; } if (flag3) { result.KillerImgSrc = KillNotifyUT.GetHero_Icon(detail.Killer, false); } result.bSrcAllies = detail.bSelfCamp; return(result); } if (detail.bAllDead) { result.MsgType = KillDetailInfoType.Info_Type_AllDead; return(result); } if (detail.HeroContiKillType != killDetailInfoType) { result.MsgType = detail.HeroContiKillType; return(result); } if (detail.Type == KillDetailInfoType.Info_Type_Kill) { return(result); } return(result); }
private void onActorDead(ref GameDeadEventParam param) { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); DebugHelper.Assert(masterRoleInfo != null, "Master Roleinfo is NULL!"); if (masterRoleInfo != null) { if ((param.atker != 0) && ActorHelper.IsHostActor(ref param.atker)) { if (param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { MonsterWrapper wrapper = param.src.handle.AsMonster(); object[] inParameters = new object[] { param.src.handle.TheActorMeta.ConfigId }; DebugHelper.Assert((wrapper != null) && (wrapper.cfgInfo != null), "Can't find Monster config -- ID: {0}", inParameters); if ((wrapper.cfgInfo.bMonsterType == 1) && !masterRoleInfo.IsNewbieAchieveSet(0)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_SOLDIER); masterRoleInfo.SetNewbieAchieve(0, true, false); } } else if (param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { ResOrganCfgInfo dataCfgInfoByCurLevelDiff = OrganDataHelper.GetDataCfgInfoByCurLevelDiff(param.src.handle.TheActorMeta.ConfigId); object[] objArray2 = new object[] { param.src.handle.TheActorMeta.ConfigId }; DebugHelper.Assert(dataCfgInfoByCurLevelDiff != null, "Can't find Organ config -- ID: {0}", objArray2); if (dataCfgInfoByCurLevelDiff.bOrganType == 1) { if (!masterRoleInfo.IsNewbieAchieveSet(1)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_DESTORY_ARROWTOWER); masterRoleInfo.SetNewbieAchieve(1, true, false); } } else if ((dataCfgInfoByCurLevelDiff.bOrganType == 2) && !masterRoleInfo.IsNewbieAchieveSet(2)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_DESTORY_BASETOWER); masterRoleInfo.SetNewbieAchieve(2, true, false); } } } if ((param.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (param.atker != 0)) { if (ActorHelper.IsHostActor(ref param.atker)) { if (!masterRoleInfo.IsNewbieAchieveSet(8)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_HERO); masterRoleInfo.SetNewbieAchieve(8, true, false); } } else if (param.atker.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_Hero) { HeroWrapper actorControl = param.src.handle.ActorControl as HeroWrapper; if (actorControl != null) { PoolObjHandle <ActorRoot> lastHeroAtker = actorControl.LastHeroAtker; if (((lastHeroAtker != 0) && ActorHelper.IsHostActor(ref lastHeroAtker)) && !masterRoleInfo.IsNewbieAchieveSet(8)) { this.ShowAchieve(enNewbieAchieve.COM_ACNT_CLIENT_BITS_TYPE_KILL_HERO); masterRoleInfo.SetNewbieAchieve(8, true, false); } } } } } }
private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (((refParamObject == null) || (refParamObject.Originator == 0)) || (refParamObject.Originator.handle.ActorControl == null)) { object[] inParameters = new object[] { _action.name }; DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", inParameters); } else if (!refParamObject.Originator.handle.ActorControl.IsDeadState) { DebugHelper.Assert(refParamObject.Originator.handle.ValueComponent != null, "ValueComponent is null"); ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey(this.ConfigID); object[] objArray2 = new object[] { this.ConfigID, _action.name }; DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", objArray2); if (dataByKey != null) { int diffLevel = Math.Min(MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject)); ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, diffLevel); object[] objArray3 = new object[] { dataByKey.dwMonsterID, diffLevel, _action.name }; DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", objArray3); if (dataCfgInfo != null) { string fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset"; CActorInfo content = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo; if (content != null) { ActorMeta actorMeta = new ActorMeta { ConfigId = (int)dataByKey.dwMonsterID, ActorType = ActorTypeDef.Actor_Type_Monster, ActorCamp = this.SelectCamp(ref refParamObject.Originator), EnCId = (CrypticInt32)dataByKey.dwMonsterID, Difficuty = (byte)diffLevel, SkinID = refParamObject.Originator.handle.TheActorMeta.SkinID }; VInt3 location = tarActor.handle.location; VInt3 forward = tarActor.handle.forward; if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, location)) { location = refParamObject.Originator.handle.location; forward = refParamObject.Originator.handle.forward; } PoolObjHandle <ActorRoot> monster = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (monster != 0) { monster.handle.InitActor(); this.ApplyMonsterAdditive(ref refParamObject.Originator, ref monster, ref dataByKey); MonsterWrapper actorControl = monster.handle.ActorControl as MonsterWrapper; if (actorControl != null) { actorControl.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo); if (this.wayPoint != null) { actorControl.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { actorControl.LifeTime = this.LifeTime; } } monster.handle.PrepareFight(); Singleton <GameObjMgr> .instance.AddActor(monster); monster.handle.StartFight(); monster.handle.ObjLinker.Invincible = this.Invincible; monster.handle.ObjLinker.CanMovable = this.Moveable; monster.handle.Visible = refParamObject.Originator.handle.Visible; monster.handle.ValueComponent.actorSoulLevel = refParamObject.Originator.handle.ValueComponent.actorSoulLevel; refParamObject.Originator.handle.ValueComponent.AddSoulExp(0, false, AddSoulType.Other); } } } } } }
private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (refParamObject == null || !refParamObject.Originator || refParamObject.Originator.get_handle().ActorControl == null) { DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", new object[] { _action.name }); return; } if (refParamObject.Originator.get_handle().ActorControl.IsDeadState) { return; } DebugHelper.Assert(refParamObject.Originator.get_handle().ValueComponent != null, "ValueComponent is null"); ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)this.ConfigID); DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", new object[] { this.ConfigID, _action.name }); if (dataByKey == null) { return; } int num = Math.Min(CallMonsterTick.MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject)); ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, num); DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", new object[] { dataByKey.dwMonsterID, num, _action.name }); if (dataCfgInfo == null) { return; } string text = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset"; CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(text, typeof(CActorInfo), 0, false, false).m_content as CActorInfo; if (exists) { ActorMeta actorMeta = default(ActorMeta); ActorMeta actorMeta2 = actorMeta; actorMeta2.ConfigId = (int)dataByKey.dwMonsterID; actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster; actorMeta2.ActorCamp = this.SelectCamp(ref refParamObject.Originator); actorMeta2.EnCId = (int)dataByKey.dwMonsterID; actorMeta2.Difficuty = (byte)num; actorMeta2.SkinID = refParamObject.Originator.get_handle().TheActorMeta.SkinID; actorMeta = actorMeta2; VInt3 location = tarActor.get_handle().location; VInt3 forward = tarActor.get_handle().forward; if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), location)) { location = refParamObject.Originator.get_handle().location; forward = refParamObject.Originator.get_handle().forward; } PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (poolObjHandle) { poolObjHandle.get_handle().InitActor(); this.ApplyMonsterAdditive(ref refParamObject.Originator, ref poolObjHandle, ref dataByKey); MonsterWrapper monsterWrapper = poolObjHandle.get_handle().ActorControl as MonsterWrapper; if (monsterWrapper != null) { monsterWrapper.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo); if (this.wayPoint != null) { monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { monsterWrapper.LifeTime = this.LifeTime; } } poolObjHandle.get_handle().PrepareFight(); Singleton <GameObjMgr> .get_instance().AddActor(poolObjHandle); poolObjHandle.get_handle().StartFight(); poolObjHandle.get_handle().ObjLinker.Invincible = this.Invincible; poolObjHandle.get_handle().ObjLinker.CanMovable = this.Moveable; poolObjHandle.get_handle().Visible = refParamObject.Originator.get_handle().Visible; poolObjHandle.get_handle().ValueComponent.actorSoulLevel = refParamObject.Originator.get_handle().ValueComponent.actorSoulLevel; refParamObject.Originator.get_handle().ValueComponent.AddSoulExp(0, false, AddSoulType.Other); } } }
private void SpawnMonster(Action _action, ref PoolObjHandle <ActorRoot> tarActor) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (refParamObject == null || !refParamObject.Originator || refParamObject.Originator.handle.ActorControl == null) { DebugHelper.Assert(false, "Failed find orignal actor of this skill. action:{0}", new object[] { _action.name }); return; } if (refParamObject.Originator.handle.ActorControl.IsDeadState) { return; } DebugHelper.Assert(refParamObject.Originator.handle.ValueComponent != null, "ValueComponent is null"); ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)this.ConfigID); DebugHelper.Assert(dataByKey != null, "Failed find call monster config id:{0} action:{1}", new object[] { this.ConfigID, _action.name }); if (dataByKey == null) { return; } int num = Math.Min(CallMonsterTick.MaxLevel, this.SelectLevel(ref refParamObject.Originator, ref dataByKey, ref refParamObject)); ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, num); DebugHelper.Assert(dataCfgInfo != null, "Failed find monster id={0} diff={1} action:{2}", new object[] { dataByKey.dwMonsterID, num, _action.name }); if (dataCfgInfo == null) { return; } string fullPathInResources = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo) + ".asset"; CActorInfo exists = Singleton <CResourceManager> .GetInstance().GetResource(fullPathInResources, typeof(CActorInfo), enResourceType.BattleScene, false, false).m_content as CActorInfo; if (exists) { ActorMeta actorMeta = default(ActorMeta); ActorMeta actorMeta2 = actorMeta; actorMeta2.ConfigId = (int)dataByKey.dwMonsterID; actorMeta2.ActorType = ActorTypeDef.Actor_Type_Monster; actorMeta2.ActorCamp = this.SelectCamp(ref refParamObject.Originator); actorMeta2.EnCId = (int)dataByKey.dwMonsterID; actorMeta2.Difficuty = (byte)num; actorMeta2.SkinID = refParamObject.Originator.handle.TheActorMeta.SkinID; actorMeta = actorMeta2; VInt3 location = tarActor.handle.location; VInt3 forward = tarActor.handle.forward; if (!PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, location)) { location = refParamObject.Originator.handle.location; forward = refParamObject.Originator.handle.forward; } PoolObjHandle <ActorRoot> poolObjHandle = Singleton <GameObjMgr> .GetInstance().SpawnActorEx(null, ref actorMeta, location, forward, false, true); if (poolObjHandle) { poolObjHandle.handle.InitActor(); this.ApplyMonsterAdditive(ref refParamObject.Originator, ref poolObjHandle, ref dataByKey); MonsterWrapper monsterWrapper = poolObjHandle.handle.ActorControl as MonsterWrapper; if (monsterWrapper != null) { monsterWrapper.SetHostActorInfo(ref refParamObject.Originator, refParamObject.SlotType, this.bCopyedHeroInfo, this.bSuicideWhenHostDead, this.bDrageToHostWhenTooFarAway, this.bUseHostValueProperty); if (this.wayPoint != null) { monsterWrapper.AttackAlongRoute(this.wayPoint.GetComponent <WaypointsHolder>()); } if (this.LifeTime > 0) { monsterWrapper.LifeTime = this.LifeTime; } } if (this.bUseHostValueProperty) { refParamObject.Originator.handle.ValueComponent.mActorValue.SetChangeEvent(RES_FUNCEFT_TYPE.RES_FUNCEFT_MOVESPD, new ValueChangeDelegate(poolObjHandle.handle.ActorControl.OnMoveSpdChange)); } refParamObject.Originator.handle.SkillControl.SetSkillIndicatorToCallMonster(); poolObjHandle.handle.PrepareFight(); Singleton <GameObjMgr> .instance.AddActor(poolObjHandle); poolObjHandle.handle.StartFight(); poolObjHandle.handle.ObjLinker.Invincible = this.Invincible; poolObjHandle.handle.ObjLinker.CanMovable = this.Moveable; poolObjHandle.handle.Visible = (!this.bInitialVisibility || refParamObject.Originator.handle.Visible); poolObjHandle.handle.ValueComponent.actorSoulLevel = refParamObject.Originator.handle.ValueComponent.actorSoulLevel; poolObjHandle.handle.DefaultAttackModeControl = poolObjHandle.handle.CreateLogicComponent <DefaultAttackMode>(poolObjHandle.handle); if (FogOfWar.enable && poolObjHandle.handle.HorizonMarker != null) { poolObjHandle.handle.HorizonMarker.SightRadius = Horizon.QuerySoldierSightRadius(); } refParamObject.Originator.handle.ValueComponent.AddSoulExp(0, false, AddSoulType.Other); } } }
public static KillInfo Convert_DetailInfo_KillInfo(KillDetailInfo detail) { KillInfo info; KillDetailInfoType type = KillDetailInfoType.Info_Type_None; PoolObjHandle <ActorRoot> killer = detail.Killer; PoolObjHandle <ActorRoot> victim = detail.Victim; bool flag = false; bool flag2 = false; bool flag3 = false; if (killer != 0) { flag = killer.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ; flag2 = killer.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster; flag3 = killer.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero; } info = new KillInfo { KillerImgSrc = info.VictimImgSrc = string.Empty, MsgType = detail.Type, bPlayerSelf_KillOrKilled = detail.bPlayerSelf_KillOrKilled, actorType = (killer == 0) ? ActorTypeDef.Invalid : killer.handle.TheActorMeta.ActorType, bSrcAllies = detail.bSelfCamp }; if (flag2) { info.KillerImgSrc = KillNotify.monster_icon; } if (flag) { info.KillerImgSrc = KillNotify.building_icon; } if (flag3) { info.KillerImgSrc = GetHero_Icon(detail.Killer); } if (killer != 0) { if (killer.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { info.KillerImgSrc = KillNotify.building_icon; } if (killer.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) { MonsterWrapper wrapper = killer.handle.AsMonster(); if (killer.handle.TheActorMeta.ConfigId == Singleton <BattleLogic> .instance.DragonId) { info.KillerImgSrc = KillNotify.dragon_icon; } else if ((wrapper.cfgInfo != null) && (wrapper.cfgInfo.bMonsterType == 2)) { info.KillerImgSrc = KillNotify.yeguai_icon; } else { info.KillerImgSrc = KillNotify.monster_icon; } } if (killer.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { info.KillerImgSrc = GetHero_Icon(killer); } } if (victim != 0) { if (victim.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { info.VictimImgSrc = GetHero_Icon(victim); } if (victim.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { info.VictimImgSrc = KillNotify.building_icon; } if ((victim.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) && (victim.handle.TheActorMeta.ConfigId == Singleton <BattleLogic> .instance.DragonId)) { info.VictimImgSrc = KillNotify.dragon_icon; } } if (detail.Type == KillDetailInfoType.Info_Type_Soldier_Boosted) { info.KillerImgSrc = !detail.bSelfCamp ? KillNotify.red_soldier_icon : KillNotify.blue_soldier_icon; return(info); } if ((detail.Type == KillDetailInfoType.Info_Type_Reconnect) || (detail.Type == KillDetailInfoType.Info_Type_RunningMan)) { info.VictimImgSrc = string.Empty; return(info); } if (detail.HeroMultiKillType != type) { info.MsgType = detail.HeroMultiKillType; return(info); } if (detail.Type != KillDetailInfoType.Info_Type_StopMultiKill) { if (detail.Type == KillDetailInfoType.Info_Type_First_Kill) { return(info); } if (detail.Type == KillDetailInfoType.Info_Type_DestroyTower) { return(info); } if (detail.Type == KillDetailInfoType.Info_Type_KillDragon) { if (flag2) { info.KillerImgSrc = KillNotify.monster_icon; } if (flag) { info.KillerImgSrc = KillNotify.building_icon; } if (flag3) { info.KillerImgSrc = GetHero_Icon(detail.Killer); } info.bSrcAllies = detail.bSelfCamp; return(info); } if (detail.bAllDead) { info.MsgType = KillDetailInfoType.Info_Type_AllDead; return(info); } if (detail.HeroContiKillType != type) { info.MsgType = detail.HeroContiKillType; return(info); } if (detail.Type == KillDetailInfoType.Info_Type_Kill) { return(info); } } return(info); }