예제 #1
0
 public override void Born(ActorRoot owner)
 {
     base.Born(owner);
     this.originalPos = this.actor.location;
     if (this.actor.ActorMesh != null)
     {
         this.originalMeshScale = this.actor.ActorMesh.transform.localScale;
     }
     this.actor.isMovable         = this.actor.ObjLinker.CanMovable;
     this.actor.MovementComponent = this.actor.CreateLogicComponent <PlayerMovement>(this.actor);
     this.actor.MatHurtEffect     = this.actor.CreateActorComponent <MaterialHurtEffect>(this.actor);
     this.actor.ShadowEffect      = this.actor.CreateActorComponent <UpdateShadowPlane>(this.actor);
     VCollisionShape.InitActorCollision(this.actor);
     this.cfgInfo = MonsterDataHelper.GetDataCfgInfo(this.actor.TheActorMeta.ConfigId, (int)this.actor.TheActorMeta.Difficuty);
     if (this.cfgInfo != null)
     {
         this.endurance = this.cfgInfo.iPursuitE;
     }
     DebugHelper.Assert(this.cfgInfo != null, "Failed find monster cfg by id {0}", new object[]
     {
         this.actor.TheActorMeta.ConfigId
     });
     if (this.cfgInfo != null && this.cfgInfo.bIsBoss > 0)
     {
         this.isBoss = true;
     }
     else
     {
         this.isBoss = false;
     }
     this.actorSubType        = this.cfgInfo.bMonsterType;
     this.actorSubSoliderType = this.cfgInfo.bSoldierType;
 }
예제 #2
0
 public override void Born(ActorRoot owner)
 {
     base.Born(owner);
     this.originalPos = base.actor.location;
     if (base.actor.ActorMesh != null)
     {
         this.originalMeshScale = base.actor.ActorMesh.transform.localScale;
     }
     base.actor.isMovable         = base.actor.ObjLinker.CanMovable;
     base.actor.MovementComponent = base.actor.CreateLogicComponent <PlayerMovement>(base.actor);
     base.actor.MatHurtEffect     = base.actor.CreateActorComponent <MaterialHurtEffect>(base.actor);
     base.actor.ShadowEffect      = base.actor.CreateActorComponent <UpdateShadowPlane>(base.actor);
     VCollisionShape.InitActorCollision(base.actor);
     this.cfgInfo = MonsterDataHelper.GetDataCfgInfo(base.actor.TheActorMeta.ConfigId, base.actor.TheActorMeta.Difficuty);
     if ((this.cfgInfo != null) && (this.cfgInfo.bIsBoss > 0))
     {
         this.isBoss = true;
     }
     else
     {
         this.isBoss = false;
     }
     base.actorSubType        = this.cfgInfo.bMonsterType;
     base.actorSubSoliderType = this.cfgInfo.bSoldierType;
     if (this.cfgInfo.iDropProbability == 0x65)
     {
         BattleMisc.BossRoot = base.actorPtr;
     }
 }
예제 #3
0
        protected override bool BuildMonsterData(ref ActorMeta actorMeta, ref ActorStaticData actorData)
        {
            ResMonsterCfgInfo resMonsterCfgInfo = this.ConsiderDifficultyToChooseMonsterCfg((uint)actorData.TheActorMeta.ConfigId, actorData.TheActorMeta.Difficuty);

            if (resMonsterCfgInfo == null)
            {
                resMonsterCfgInfo = MonsterDataHelper.GetDataCfgInfo(actorData.TheActorMeta.ConfigId, (int)actorData.TheActorMeta.Difficuty);
                if (resMonsterCfgInfo == null)
                {
                    resMonsterCfgInfo = MonsterDataHelper.GetDataCfgInfo(actorData.TheActorMeta.ConfigId, 1);
                }
                if (resMonsterCfgInfo == null)
                {
                    base.ErrorMissingMonsterConfig((uint)actorData.TheActorMeta.ConfigId);
                    return(false);
                }
            }
            DynamicAttributeInfo dynamicAttributeInfo = this.ConsiderMonsterDynamicInfo(resMonsterCfgInfo);

            actorData.TheBaseAttribute.EpType                           = 1u;
            actorData.TheBaseAttribute.BaseHp                           = ((dynamicAttributeInfo == null) ? resMonsterCfgInfo.iBaseHP : dynamicAttributeInfo.iBaseHP);
            actorData.TheBaseAttribute.PerLvHp                          = 0;
            actorData.TheBaseAttribute.BaseAd                           = ((dynamicAttributeInfo == null) ? resMonsterCfgInfo.iBaseATT : dynamicAttributeInfo.iAD);
            actorData.TheBaseAttribute.PerLvAd                          = 0;
            actorData.TheBaseAttribute.BaseAp                           = ((dynamicAttributeInfo == null) ? resMonsterCfgInfo.iBaseINT : dynamicAttributeInfo.iAP);
            actorData.TheBaseAttribute.PerLvAp                          = 0;
            actorData.TheBaseAttribute.BaseAtkSpeed                     = 0;
            actorData.TheBaseAttribute.PerLvAtkSpeed                    = 0;
            actorData.TheBaseAttribute.BaseDef                          = ((dynamicAttributeInfo == null) ? resMonsterCfgInfo.iBaseDEF : dynamicAttributeInfo.iDef);
            actorData.TheBaseAttribute.PerLvDef                         = 0;
            actorData.TheBaseAttribute.BaseRes                          = ((dynamicAttributeInfo == null) ? resMonsterCfgInfo.iBaseRES : dynamicAttributeInfo.iRes);
            actorData.TheBaseAttribute.PerLvRes                         = 0;
            actorData.TheBaseAttribute.BaseHpRecover                    = resMonsterCfgInfo.iBaseHPAdd;
            actorData.TheBaseAttribute.PerLvHpRecover                   = 0;
            actorData.TheBaseAttribute.CriticalChance                   = 0;
            actorData.TheBaseAttribute.CriticalDamage                   = 0;
            actorData.TheBaseAttribute.Sight                            = resMonsterCfgInfo.iSightR;
            actorData.TheBaseAttribute.MoveSpeed                        = resMonsterCfgInfo.iBaseSpeed;
            actorData.TheBaseAttribute.SoulExpGained                    = resMonsterCfgInfo.iSoulExp;
            actorData.TheBaseAttribute.GoldCoinInBattleGained           = (int)resMonsterCfgInfo.wStartingGoldCoinInBattle;
            actorData.TheBaseAttribute.GoldCoinInBattleGainedFloatRange = (int)resMonsterCfgInfo.bGoldCoinInBattleRange;
            actorData.TheBaseAttribute.DynamicProperty                  = resMonsterCfgInfo.dwDynamicPropertyCfg;
            actorData.TheBaseAttribute.ClashMark                        = resMonsterCfgInfo.dwClashMark;
            actorData.TheBaseAttribute.RandomPassiveSkillRule           = (int)resMonsterCfgInfo.bRandomPassiveSkillRule;
            actorData.TheBaseAttribute.PassiveSkillID1                  = 0;
            actorData.TheBaseAttribute.PassiveSkillID2                  = 0;
            actorData.TheBaseAttribute.DeadControl                      = false;
            actorData.TheMonsterOnlyInfo.MonsterBaseLevel               = resMonsterCfgInfo.iLevel;
            actorData.TheMonsterOnlyInfo.SoldierType                    = resMonsterCfgInfo.bSoldierType;
            actorData.TheResInfo.Name    = StringHelper.UTF8BytesToString(ref resMonsterCfgInfo.szName);
            actorData.TheResInfo.ResPath = StringHelper.UTF8BytesToString(ref resMonsterCfgInfo.szCharacterInfo);
            actorData.ProviderType       = GameActorDataProviderType.StaticBattleDataProvider;
            return(true);
        }
예제 #4
0
        protected virtual bool BuildMonsterSkillData(ref ActorMeta actorMeta, ActorSkillSlot skillSlot, ref ActorStaticSkillData skillData)
        {
            int index = (int)skillSlot;
            ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo(skillData.TheActorMeta.ConfigId, skillData.TheActorMeta.Difficuty);

            if (dataCfgInfo == null)
            {
                base.ErrorMissingMonsterConfig((uint)skillData.TheActorMeta.ConfigId);
                return(false);
            }
            if (index >= dataCfgInfo.SkillIDs.Length)
            {
                return(false);
            }
            skillData.SkillId        = dataCfgInfo.SkillIDs[index];
            skillData.PassiveSkillId = dataCfgInfo.PassiveSkillID[index];
            return((skillData.SkillId > 0) || (skillData.PassiveSkillId > 0));
        }
예제 #5
0
 private void CheckCallMonsterSkill(CActorInfo InActorInfo, ref List <ActorPreloadTab> InPreloadListRef, ref ActorMeta InParentActorMetaRef, int markID)
 {
     if (InActorInfo != null && InActorInfo.callMonsterConfigID > 0)
     {
         ResCallMonster dataByKey = GameDataMgr.callMonsterDatabin.GetDataByKey((long)InActorInfo.callMonsterConfigID);
         if (dataByKey != null)
         {
             ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo((int)dataByKey.dwMonsterID, 1);
             if (dataCfgInfo != null)
             {
                 ActorMeta actorMeta = default(ActorMeta);
                 actorMeta.ActorType = ActorTypeDef.Actor_Type_Monster;
                 actorMeta.ActorCamp = InParentActorMetaRef.ActorCamp;
                 actorMeta.ConfigId  = dataCfgInfo.iCfgID;
                 this.AddPreloadActor(ref InPreloadListRef, ref actorMeta, 2f, markID);
             }
         }
     }
 }
        protected override bool BuildMonsterData(ref ActorMeta actorMeta, ref ActorStaticData actorData)
        {
            ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo(actorData.TheActorMeta.ConfigId, (int)actorData.TheActorMeta.Difficuty);

            if (dataCfgInfo == null)
            {
                dataCfgInfo = MonsterDataHelper.GetDataCfgInfo(actorData.TheActorMeta.ConfigId, 1);
            }
            if (dataCfgInfo == null)
            {
                base.ErrorMissingMonsterConfig((uint)actorData.TheActorMeta.ConfigId);
                return(false);
            }
            actorData.TheBaseAttribute.EpType                           = 1u;
            actorData.TheBaseAttribute.BaseHp                           = dataCfgInfo.iBaseHP;
            actorData.TheBaseAttribute.PerLvHp                          = 0;
            actorData.TheBaseAttribute.BaseAd                           = dataCfgInfo.iBaseATT;
            actorData.TheBaseAttribute.PerLvAd                          = 0;
            actorData.TheBaseAttribute.BaseAp                           = dataCfgInfo.iBaseINT;
            actorData.TheBaseAttribute.PerLvAp                          = 0;
            actorData.TheBaseAttribute.BaseAtkSpeed                     = 0;
            actorData.TheBaseAttribute.PerLvAtkSpeed                    = 0;
            actorData.TheBaseAttribute.BaseDef                          = dataCfgInfo.iBaseDEF;
            actorData.TheBaseAttribute.PerLvDef                         = 0;
            actorData.TheBaseAttribute.BaseRes                          = dataCfgInfo.iBaseRES;
            actorData.TheBaseAttribute.PerLvRes                         = 0;
            actorData.TheBaseAttribute.BaseHpRecover                    = dataCfgInfo.iBaseHPAdd;
            actorData.TheBaseAttribute.PerLvHpRecover                   = 0;
            actorData.TheBaseAttribute.CriticalChance                   = 0;
            actorData.TheBaseAttribute.CriticalDamage                   = 0;
            actorData.TheBaseAttribute.Sight                            = dataCfgInfo.iSightR;
            actorData.TheBaseAttribute.MoveSpeed                        = dataCfgInfo.iBaseSpeed;
            actorData.TheBaseAttribute.SoulExpGained                    = dataCfgInfo.iSoulExp;
            actorData.TheBaseAttribute.GoldCoinInBattleGained           = (int)dataCfgInfo.wStartingGoldCoinInBattle;
            actorData.TheBaseAttribute.GoldCoinInBattleGainedFloatRange = (int)dataCfgInfo.bGoldCoinInBattleRange;
            actorData.TheBaseAttribute.DynamicProperty                  = dataCfgInfo.dwDynamicPropertyCfg;
            actorData.TheBaseAttribute.ClashMark                        = dataCfgInfo.dwClashMark;
            actorData.TheResInfo.Name    = StringHelper.UTF8BytesToString(ref dataCfgInfo.szName);
            actorData.TheResInfo.ResPath = StringHelper.UTF8BytesToString(ref dataCfgInfo.szCharacterInfo);
            actorData.ProviderType       = GameActorDataProviderType.StaticLobbyDataProvider;
            return(true);
        }
예제 #7
0
 public override void Born(ActorRoot owner)
 {
     this.actor    = owner;
     this.actorPtr = new PoolObjHandle <ActorRoot>(this.actor);
     base.ClearNeedToHelpOther();
     base.ClearNeedSwitchTarget();
     this.m_curWaypointsHolder    = null;
     this.m_curWaypointTarget     = null;
     this.m_isCurWaypointEndPoint = false;
     this.m_isStartPoint          = false;
     this.m_isControledByMan      = true;
     this.m_isAutoAI              = false;
     this.m_offline               = false;
     this.m_followOther           = false;
     this.m_leaderID              = 0u;
     this.m_isAttackedByEnemyHero = false;
     this.m_isAttacked            = false;
     this.bForceNotRevive         = false;
     this.actor.SkillControl      = this.actor.CreateLogicComponent <SkillComponent>(this.actor);
     this.actor.ValueComponent    = this.actor.CreateLogicComponent <ValueProperty>(this.actor);
     this.actor.HurtControl       = this.actor.CreateLogicComponent <HurtComponent>(this.actor);
     this.actor.BuffHolderComp    = this.actor.CreateLogicComponent <BuffHolderComponent>(this.actor);
     this.actor.AnimControl       = this.actor.CreateLogicComponent <AnimPlayComponent>(this.actor);
     this.actor.HudControl        = this.actor.CreateLogicComponent <HudComponent3D>(this.actor);
     if (FogOfWar.enable)
     {
         this.actor.HorizonMarker = this.actor.CreateLogicComponent <HorizonMarkerByFow>(this.actor);
     }
     else
     {
         this.actor.HorizonMarker = this.actor.CreateLogicComponent <HorizonMarker>(this.actor);
     }
     this.actor.MatHurtEffect = this.actor.CreateActorComponent <MaterialHurtEffect>(this.actor);
     if (this.actor.MatHurtEffect != null && this.actor.MatHurtEffect.mats != null)
     {
         this.actor.MatHurtEffect.mats.Clear();
         this.actor.MatHurtEffect.mats = null;
     }
     this.cfgInfo       = MonsterDataHelper.GetDataCfgInfo(this.actor.TheActorMeta.ConfigId, 1);
     this.bLifeTimeOver = false;
 }
        protected virtual bool BuildMonsterSkillData(ref ActorMeta actorMeta, ActorSkillSlot skillSlot, ref ActorStaticSkillData skillData)
        {
            ResMonsterCfgInfo dataCfgInfo = MonsterDataHelper.GetDataCfgInfo(skillData.TheActorMeta.ConfigId, (int)skillData.TheActorMeta.Difficuty);

            if (dataCfgInfo == null)
            {
                dataCfgInfo = MonsterDataHelper.GetDataCfgInfo(skillData.TheActorMeta.ConfigId, 1);
            }
            if (dataCfgInfo == null)
            {
                base.ErrorMissingMonsterConfig((uint)skillData.TheActorMeta.ConfigId);
                return(false);
            }
            if (skillSlot >= (ActorSkillSlot)dataCfgInfo.SkillIDs.Length)
            {
                return(false);
            }
            skillData.SkillId        = dataCfgInfo.SkillIDs[(int)skillSlot];
            skillData.PassiveSkillId = dataCfgInfo.PassiveSkillID[(int)skillSlot];
            return(skillData.SkillId > 0 || skillData.PassiveSkillId > 0);
        }
예제 #9
0
        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);
                            }
                        }
                    }
                }
            }
        }
 internal ResMonsterCfgInfo ConsiderDifficultyToChooseMonsterCfg(uint monsterCfgId, byte diff)
 {
     return(MonsterDataHelper.GetDataCfgInfo((int)monsterCfgId, diff));
 }
예제 #11
0
        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);
                }
            }
        }
예제 #13
0
    public static ResMonsterCfgInfo GetDataCfgInfoByCurLevelDiff(int configID)
    {
        SLevelContext curLvelContext = Singleton <BattleLogic> .GetInstance().GetCurLvelContext();

        return(MonsterDataHelper.GetDataCfgInfo(configID, curLvelContext.m_levelDifficulty));
    }