Esempio n. 1
0
 private void AddBehaviorTree(CActorInfo info)
 {
     if ((((info != null) && (info.BtResourcePath != null)) && (info.BtResourcePath.Length != 0)) && !this.behaviourDict.ContainsKey(info.BtResourcePath))
     {
         this.behaviourDict.Add(info.BtResourcePath, false);
     }
 }
Esempio n. 2
0
 public void AnalyseSoundBanks(ref ActorPreloadTab loadInfo, ref CActorInfo charInfo, ref ActorServerData serverData)
 {
     if (charInfo.SoundBanks != null && charInfo.SoundBanks.Length > 0)
     {
         for (int i = 0; i < charInfo.SoundBanks.Length; i++)
         {
             AssetLoadBase assetLoadBase = default(AssetLoadBase);
             assetLoadBase.assetPath = charInfo.SoundBanks[i];
             loadInfo.soundBanks.Add(assetLoadBase);
         }
     }
     if (serverData.SkinId != 0u)
     {
         ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin((uint)loadInfo.theActor.ConfigId, serverData.SkinId);
         if (heroSkin != null && !string.IsNullOrEmpty(heroSkin.szSkinSoundResPack))
         {
             AssetLoadBase assetLoadBase2 = default(AssetLoadBase);
             assetLoadBase2.assetPath = heroSkin.szSkinSoundResPack + "_SFX";
             loadInfo.soundBanks.Add(assetLoadBase2);
             assetLoadBase2           = default(AssetLoadBase);
             assetLoadBase2.assetPath = heroSkin.szSkinSoundResPack + "_VO";
             loadInfo.soundBanks.Add(assetLoadBase2);
         }
     }
 }
Esempio n. 3
0
 public void AnalyseSoundBanks(ref ActorPreloadTab loadInfo, ref CActorInfo charInfo, ref ActorServerData serverData)
 {
     if ((charInfo.SoundBanks != null) && (charInfo.SoundBanks.Length > 0))
     {
         for (int i = 0; i < charInfo.SoundBanks.Length; i++)
         {
             AssetLoadBase item = new AssetLoadBase {
                 assetPath = charInfo.SoundBanks[i]
             };
             loadInfo.soundBanks.Add(item);
         }
     }
     if (serverData.SkinId != 0)
     {
         ResHeroSkin heroSkin = CSkinInfo.GetHeroSkin((uint)loadInfo.theActor.ConfigId, serverData.SkinId);
         if ((heroSkin != null) && !string.IsNullOrEmpty(heroSkin.szSkinSoundResPack))
         {
             AssetLoadBase base3 = new AssetLoadBase {
                 assetPath = heroSkin.szSkinSoundResPack + "_SFX"
             };
             loadInfo.soundBanks.Add(base3);
             base3 = new AssetLoadBase {
                 assetPath = heroSkin.szSkinSoundResPack + "_VO"
             };
             loadInfo.soundBanks.Add(base3);
         }
     }
 }
Esempio n. 4
0
        /// Добавление нового лица в диалог
        private void AddActor(string actorName)
        {
            Assert.IsTrue(!_actorNameToIndex.ContainsKey(actorName), "Arrangement with type 'appear' is applied to the present actor");
            CActorInfo actorInfo = new CActorInfo();

            actorInfo.ActorName = actorName;

            // Создаём объект с изображением диалогового лица
            var actorImage = new GameObject().AddComponent <Image>();

            actorImage.transform.SetParent(transform);
            actorImage.transform.position   = new Vector3(0f, 0f, 0f);
            actorImage.transform.localScale = new Vector3(1f, 1f, 1f);
            actorInfo.ActorObject           = actorImage.gameObject;
            actorInfo.Index = _allActors.Count();
            _actorNameToIndex.Add(actorName, _allActors.Count);

            // Выставим дефолтную позицию, если не указана
            if (actorInfo.PositionType != TDialogueActorArrangementPosition.Custom)
            {
                actorInfo.Position.x = GetDefaultPosition(actorInfo.PositionType);
            }

            _allActors.Add(actorInfo);

            // Всегда пытаемся отобразить новое лицо, даже если оно ничего не сказало
            MakeLeading(actorName);
        }
Esempio n. 5
0
    private void AddActionsFromSoldier(DictionaryView <string, Action> actions, 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 == null)
        {
            return;
        }
        this.AddBehaviorTree(actorInfo);
        string artPrefabName = actorInfo.GetArtPrefabName(0, -1);

        if (!this.prefabDict.ContainsKey(artPrefabName))
        {
            this.prefabDict.Add(artPrefabName, false);
        }
        if (dataCfgInfoByCurLevelDiff.SkillIDs != null && dataCfgInfoByCurLevelDiff.SkillIDs.Length > 0)
        {
            for (int i = 0; i < dataCfgInfoByCurLevelDiff.SkillIDs.Length; i++)
            {
                int skillID = dataCfgInfoByCurLevelDiff.SkillIDs[i];
                this.AddActionsFromSkill(actions, skillID);
            }
        }
    }
Esempio n. 6
0
        private string GetMeshName(ref PoolObjHandle <ActorRoot> actor)
        {
            ActorMeta actorMeta  = default(ActorMeta);
            ActorMeta actorMeta2 = actorMeta;

            actorMeta2.ConfigId  = actor.handle.TheActorMeta.ConfigId;
            actorMeta2.ActorCamp = actor.handle.TheActorMeta.ActorCamp;
            actorMeta2.PlayerId  = actor.handle.TheActorMeta.PlayerId;
            actorMeta            = actorMeta2;
            ActorStaticData        actorStaticData   = default(ActorStaticData);
            IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

            actorDataProvider.GetActorStaticData(ref actorMeta, ref actorStaticData);
            if (!string.IsNullOrEmpty(actorStaticData.TheResInfo.ResPath))
            {
                CActorInfo actorInfo = CActorInfo.GetActorInfo(actorStaticData.TheResInfo.ResPath, enResourceType.BattleScene);
                if (actorInfo != null)
                {
                    string artPrefabName = actorInfo.GetArtPrefabName((int)actorMeta.SkinID, -1);
                    if (!string.IsNullOrEmpty(artPrefabName))
                    {
                        return(artPrefabName);
                    }
                }
            }
            return(string.Empty);
        }
Esempio n. 7
0
        // Удаление и добавление лиц
        private void PrepareActors(CDialogueActorsArrangements arrangements, out bool mustChangeArrangement)
        {
            _removedActorsIndices.Clear();
            // Сначала определим изменения в расположении лиц
            mustChangeArrangement = false;

            int prevMaxActorsOnScreen = _maxActorsOnScreen;

            _maxActorsOnScreen = arrangements.UseDefaultMaxActorsOnScreen ? DialogueStatementDefaultValues.MaxActorsOnScreen : arrangements.MaxActorsOnScreen;
            if (prevMaxActorsOnScreen != _maxActorsOnScreen)
            {
                mustChangeArrangement = true;
            }

            // Рассмотрим все описания аранжировок, добавим и удалим лица при необходимости, определим, нужно ли менять расположение лиц диалога.
            foreach (var arrangement in arrangements.Arrangements)
            {
                switch (arrangement.ArrangementAction)
                {
                case TDialogueActorArrangementAction.Appear:
                    AddActor(arrangement.ActorName);
                    mustChangeArrangement = true;
                    break;

                case TDialogueActorArrangementAction.Leave:
                    DeleteActor(arrangement.ActorName);
                    mustChangeArrangement = true;
                    break;

                case TDialogueActorArrangementAction.ChangePosition:
                    Assert.IsTrue(_actorNameToIndex.ContainsKey(arrangement.ActorName), "Arrangement with type 'changePosition' is applied to the absent actor");
                    CActorInfo actorInfo = _allActors[_actorNameToIndex[arrangement.ActorName]];
                    if (actorInfo.PositionType != arrangement.Position ||
                        (arrangement.Position == TDialogueActorArrangementPosition.Custom && arrangement.ExactPosistion != actorInfo.Position))
                    {
                        mustChangeArrangement = true;
                    }
                    break;

                default:
                    Assert.IsTrue(false);
                    break;
                }

                if (arrangement.ArrangementAction != TDialogueActorArrangementAction.Leave)
                {
                    CActorInfo actorInfo = _allActors[_actorNameToIndex[arrangement.ActorName]];
                    actorInfo.PositionType = arrangement.Position;
                    if (arrangement.Position == TDialogueActorArrangementPosition.Custom)
                    {
                        actorInfo.Position = arrangement.ExactPosistion;
                    }
                    actorInfo.UseAutosize    = arrangement.UseAutoSize;
                    actorInfo.UseCustomScale = arrangement.UseCustomScale;
                    actorInfo.Scale          = arrangement.Scale;
                    actorInfo.Size           = arrangement.Size;
                }
            }
        }
        public void ProcessInner(Action _action, Track _track, int delta)
        {
            VInt3 location = this.moveActor.handle.location;

            if ((this.MoveType == ActorMoveType.Target) && (this.tarActor != 0))
            {
                this.destPosition = this.tarActor.handle.location;
                if ((this.tarActor != 0) && (this.tarActor.handle.CharInfo != null))
                {
                    CActorInfo charInfo = this.tarActor.handle.CharInfo;
                    this.hitHeight = charInfo.iBulletHeight;
                    VInt3 a = this.moveActor.handle.location - this.destPosition;
                    a.y = 0;
                    a   = a.NormalizeTo(0x3e8);
                    this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 0x3e8L);
                }
                this.destPosition.y += this.hitHeight;
            }
            this.moveDirection = this.destPosition - location;
            this.lerpDirection = this.moveDirection;
            if (this.bMoveRotate)
            {
                this.RotateMoveBullet(this.moveDirection);
            }
            int newMagn = (this.velocity * delta) / 0x3e8;

            if ((newMagn * newMagn) >= this.moveDirection.sqrMagnitudeLong2D)
            {
                this.moveActor.handle.location = this.destPosition;
                this.stopCondtion = true;
            }
            else
            {
                VInt3 num4;
                if (this.gravity < 0)
                {
                    VInt num5;
                    this.moveDirection.y = 0;
                    num4    = location + this.moveDirection.NormalizeTo(newMagn);
                    num4.y += this.gravityControler.GetMotionDeltaDistance(delta);
                    if (PathfindingUtility.GetGroundY(this.destPosition, out num5) && (num4.y < num5.i))
                    {
                        num4.y = num5.i;
                    }
                }
                else
                {
                    num4 = location + this.moveDirection.NormalizeTo(newMagn);
                }
                this.moveActor.handle.location = num4;
            }
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (refParamObject != null)
            {
                refParamObject.EffectPos = this.moveActor.handle.location;
                refParamObject.EffectDir = this.moveDirection;
            }
        }
Esempio n. 9
0
 private void AddBehaviorTree(CActorInfo info)
 {
     if (info == null || info.BtResourcePath == null || info.BtResourcePath.get_Length() == 0)
     {
         return;
     }
     if (!this.behaviourDict.ContainsKey(info.BtResourcePath))
     {
         this.behaviourDict.Add(info.BtResourcePath, false);
     }
 }
Esempio n. 10
0
        // Выставить изображения лицам
        // Также меняет положение по оси Y и размер изображениям
        private void SetActorsImages(CDialogueActorImage[] actorsImages)
        {
            foreach (CDialogueActorImage actorImage in actorsImages)
            {
                Assert.IsTrue(_actorNameToIndex.ContainsKey(actorImage.ActorName), $"There is no actor with name {actorImage.ActorName}. Check actor images descriptions.");
                // Выставляем изображение
                CActorInfo actorInfo      = _allActors[_actorNameToIndex[actorImage.ActorName]];
                Image      imageComponent = actorInfo.ActorObject.GetComponent <Image>();
                imageComponent.sprite = actorImage.Image;
            }

            int siblingIndex = transform.childCount - 1;
            int currentIndex = _leadActorIndex;

            for (int i = 0; i < _shownActorsIndices.Count; i++)
            {
                // Выставляем размер изображениям
                CActorInfo actorInfo      = _allActors[currentIndex];
                Image      imageComponent = actorInfo.ActorObject.GetComponent <Image>();
                Rect       imageRect      = new Rect();
                if (actorInfo.UseAutosize)
                {
                    imageRect.size = imageComponent.sprite.rect.size * _actorDefaultScale;
                }
                else
                {
                    if (actorInfo.UseCustomScale)
                    {
                        imageRect.size = imageComponent.sprite.rect.size * actorInfo.Scale;
                    }
                    else
                    {
                        imageRect.size = actorInfo.Size;
                    }
                }

                imageComponent.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, imageRect.width);
                imageComponent.rectTransform.SetSizeWithCurrentAnchors(RectTransform.Axis.Vertical, imageRect.height);

                // Выставляем позицию по оси y
                if (actorInfo.PositionType != TDialogueActorArrangementPosition.Custom)
                {
                    actorInfo.Position.y = _boundaries.yMin + imageRect.height / 2;
                }

                actorInfo.ActorObject.transform.SetSiblingIndex(siblingIndex--);
                currentIndex = actorInfo.NextActorIndex;
            }
        }
Esempio n. 11
0
        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;
                        }
                    }
                }
            }
        }
Esempio n. 12
0
        private void InitTarget()
        {
            VInt3 vInt = VInt3.one;
            int   num  = 0;

            this.destPosition = this.tarActor.get_handle().location;
            CActorInfo charInfo = this.tarActor.get_handle().CharInfo;

            if (charInfo != null)
            {
                num                = charInfo.iBulletHeight;
                vInt               = this.moveActor.get_handle().location - this.destPosition;
                vInt.y             = 0;
                vInt               = vInt.NormalizeTo(1000);
                this.destPosition += IntMath.Divide(vInt, (long)charInfo.iCollisionSize.x, 1000L);
            }
            this.destPosition.y = this.destPosition.y + num;
        }
Esempio n. 13
0
        private void InitTarget()
        {
            VInt3 one           = VInt3.one;
            int   iBulletHeight = 0;

            this.destPosition = this.tarActor.handle.location;
            CActorInfo charInfo = this.tarActor.handle.CharInfo;

            if (charInfo != null)
            {
                iBulletHeight      = charInfo.iBulletHeight;
                one                = this.moveActor.handle.location - this.destPosition;
                one.y              = 0;
                one                = one.NormalizeTo(0x3e8);
                this.destPosition += IntMath.Divide(one, (long)charInfo.iCollisionSize.x, 0x3e8L);
            }
            this.destPosition.y += iBulletHeight;
        }
Esempio n. 14
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);
             }
         }
     }
 }
Esempio n. 15
0
        public void InitAnimatSoundList(uint heroId, uint skinId)
        {
            this.m_animatSoundList.Clear();
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey(heroId);

            if (dataByKey != null)
            {
                CActorInfo content = Singleton <CResourceManager> .GetInstance().GetResource(StringHelper.UTF8BytesToString(ref dataByKey.szCharacterInfo), typeof(CActorInfo), enResourceType.UI3DImage, false, false).m_content as CActorInfo;

                if (content != null)
                {
                    Singleton <CSoundManager> .GetInstance().LoadSkinSoundBank(heroId, skinId, this.m_3DModel, true);

                    for (int i = 0; i < content.AnimaSound.Length; i++)
                    {
                        this.m_animatSoundList.Add(content.AnimaSound[i]);
                    }
                }
            }
        }
Esempio n. 16
0
    public void AddPreloadActor(ref List <ActorPreloadTab> list, ref ActorMeta actorMeta, float spawnCnt, int ownerSkinID = 0)
    {
        ActorStaticData        inStaticData      = default(ActorStaticData);
        IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

        actorDataProvider.GetActorStaticData(ref actorMeta, ref inStaticData);
        ActorServerData        actorServerData    = default(ActorServerData);
        IGameActorDataProvider actorDataProvider2 = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.ServerDataProvider);

        actorDataProvider2.GetActorServerData(ref actorMeta, ref actorServerData);
        CActorInfo actorInfo = CActorInfo.GetActorInfo(inStaticData.TheResInfo.ResPath, enResourceType.BattleScene);

        if (actorInfo == null)
        {
            return;
        }
        for (int i = 0; i < list.get_Count(); i++)
        {
            ActorPreloadTab actorPreloadTab = list.get_Item(i);
            if (actorPreloadTab.theActor.ActorType == actorMeta.ActorType && actorPreloadTab.theActor.ConfigId == actorMeta.ConfigId)
            {
                if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero || actorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
                {
                    int actorMarkID = this.GetActorMarkID(actorMeta);
                    if (actorMarkID != actorPreloadTab.MarkID)
                    {
                        goto IL_13B;
                    }
                    uint skillID = 0u;
                    if (actorDataProvider2.GetActorServerCommonSkillData(ref actorMeta, out skillID))
                    {
                        this.AnalyseSkill(ref actorPreloadTab, (int)skillID);
                    }
                }
                else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Monster && spawnCnt > 0f)
                {
                    actorPreloadTab.spawnCnt += spawnCnt;
                    list.set_Item(i, actorPreloadTab);
                }
                LoaderHelper.retCnt++;
                return;
            }
            IL_13B :;
        }
        ActorPreloadTab actorPreloadTab2 = new ActorPreloadTab();

        actorPreloadTab2.theActor = actorMeta;
        actorPreloadTab2.modelPrefab.assetPath    = actorInfo.GetArtPrefabName((ownerSkinID != 0) ? ownerSkinID : ((int)actorServerData.SkinId), -1);
        actorPreloadTab2.modelPrefab.nInstantiate = 1;
        actorPreloadTab2.spawnCnt   = spawnCnt;
        actorPreloadTab2.MarkID     = this.GetActorMarkID(actorMeta);
        actorPreloadTab2.ageActions = new List <AssetLoadBase>();
        actorPreloadTab2.parPrefabs = new List <AssetLoadBase>();
        actorPreloadTab2.mesPrefabs = new List <AssetLoadBase>();
        if (actorServerData.SkinId != 0u)
        {
            actorInfo.PreLoadAdvanceSkin(actorPreloadTab2.mesPrefabs, actorServerData.SkinId, -1);
        }
        actorPreloadTab2.spritePrefabs = new List <AssetLoadBase>();
        actorPreloadTab2.soundBanks    = new List <AssetLoadBase>();
        actorPreloadTab2.behaviorXml   = new List <AssetLoadBase>();
        ActorStaticSkillData actorStaticSkillData = default(ActorStaticSkillData);

        for (int j = 0; j < 8; j++)
        {
            actorDataProvider.GetActorStaticSkillData(ref actorMeta, (ActorSkillSlot)j, ref actorStaticSkillData);
            this.AnalyseSkill(ref actorPreloadTab2, actorStaticSkillData.SkillId);
            this.AnalysePassiveSkill(ref actorPreloadTab2, actorStaticSkillData.PassiveSkillId);
        }
        if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero || actorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
        {
            int skillID2;
            int skillID3;
            int skillID4;
            int passiveSkillID;
            this.GetMapSkills(out skillID2, out skillID3, out skillID4, out passiveSkillID);
            this.AnalyseSkill(ref actorPreloadTab2, skillID2);
            this.AnalyseSkill(ref actorPreloadTab2, skillID3);
            this.AnalyseSkill(ref actorPreloadTab2, skillID4);
            this.AnalysePassiveSkill(ref actorPreloadTab2, passiveSkillID);
            uint skillID5 = 0u;
            if (actorDataProvider2.GetActorServerCommonSkillData(ref actorMeta, out skillID5))
            {
                this.AnalyseSkill(ref actorPreloadTab2, (int)skillID5);
            }
            this.AnalyseHeroBornAndReviveAge(ref actorPreloadTab2, actorMeta.ConfigId);
            ResHeroCfgInfo dataByKey = GameDataMgr.heroDatabin.GetDataByKey((uint)actorMeta.ConfigId);
            if (dataByKey != null)
            {
                this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey.iPassiveID1);
                this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey.iPassiveID2);
            }
        }
        else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Monster)
        {
            ActorStaticData        actorStaticData    = default(ActorStaticData);
            IGameActorDataProvider actorDataProvider3 = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

            actorDataProvider3.GetActorStaticData(ref actorMeta, ref actorStaticData);
            int randomPassiveSkillRule = actorStaticData.TheBaseAttribute.RandomPassiveSkillRule;
            if (randomPassiveSkillRule > 0 && !this.randomSkillCheckerSet.ContainsKey(randomPassiveSkillRule))
            {
                this.randomSkillCheckerSet.Add(randomPassiveSkillRule, true);
                ResRandomSkillPassiveRule dataByKey2 = GameDataMgr.randomSkillPassiveDatabin.GetDataByKey((long)randomPassiveSkillRule);
                if (dataByKey2.astRandomSkillPassiveID1 != null && dataByKey2.astRandomSkillPassiveID1.Length > 0)
                {
                    for (int k = 0; k < dataByKey2.astRandomSkillPassiveID1.Length; k++)
                    {
                        this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey2.astRandomSkillPassiveID1[k].iParam);
                    }
                }
                if (dataByKey2.astRandomSkillPassiveID2 != null && dataByKey2.astRandomSkillPassiveID2.Length > 0)
                {
                    for (int l = 0; l < dataByKey2.astRandomSkillPassiveID2.Length; l++)
                    {
                        this.AnalysePassiveSkill(ref actorPreloadTab2, dataByKey2.astRandomSkillPassiveID2[l].iParam);
                    }
                }
            }
            ResMonsterCfgInfo dataCfgInfoByCurLevelDiff = MonsterDataHelper.GetDataCfgInfoByCurLevelDiff(actorMeta.ConfigId);
            if (dataCfgInfoByCurLevelDiff != null && dataCfgInfoByCurLevelDiff.iBufDropID != 0 && dataCfgInfoByCurLevelDiff.iBufDropRate > 0)
            {
                ShenFuSystem.PreLoadShenfuResource(dataCfgInfoByCurLevelDiff.iBufDropID, ref actorPreloadTab2, this);
            }
            if (actorStaticData.TheMonsterOnlyInfo.SoldierType == 8 && dataCfgInfoByCurLevelDiff != null)
            {
                ListView <Assets.Scripts.GameLogic.SoldierWave> listView = new ListView <Assets.Scripts.GameLogic.SoldierWave>();
                int iKillByCamp1ChangeSoldierWave = dataCfgInfoByCurLevelDiff.iKillByCamp1ChangeSoldierWave;
                int iKillByCamp2ChangeSoldierWave = dataCfgInfoByCurLevelDiff.iKillByCamp2ChangeSoldierWave;
                listView.AddRange(SoldierRegion.GetWavesForPreLoad(iKillByCamp1ChangeSoldierWave));
                listView.AddRange(SoldierRegion.GetWavesForPreLoad(iKillByCamp2ChangeSoldierWave));
                for (int m = 0; m < listView.Count; m++)
                {
                    Assets.Scripts.GameLogic.SoldierWave soldierWave = listView[m];
                    if (soldierWave != null && soldierWave.WaveInfo != null && soldierWave.WaveInfo.astNormalSoldierInfo != null && soldierWave.WaveInfo.astNormalSoldierInfo.Length > 0)
                    {
                        for (int n = 0; n < soldierWave.WaveInfo.astNormalSoldierInfo.Length; n++)
                        {
                            ResSoldierTypeInfo resSoldierTypeInfo = soldierWave.WaveInfo.astNormalSoldierInfo[n];
                            if (resSoldierTypeInfo.dwSoldierID == 0u)
                            {
                                break;
                            }
                            ActorMeta actorMeta2 = default(ActorMeta);
                            ActorMeta actorMeta3 = actorMeta2;
                            actorMeta3.ActorType = ActorTypeDef.Actor_Type_Monster;
                            actorMeta3.ConfigId  = (int)resSoldierTypeInfo.dwSoldierID;
                            actorMeta2           = actorMeta3;
                            this.AddPreloadActor(ref list, ref actorMeta2, resSoldierTypeInfo.dwSoldierNum * 2f, 0);
                        }
                    }
                }
            }
        }
        if (!string.IsNullOrEmpty(actorInfo.deadAgePath))
        {
            actorPreloadTab2.ageActions.Add(new AssetLoadBase
            {
                assetPath = actorInfo.deadAgePath
            });
        }
        if (!string.IsNullOrEmpty(actorInfo.BtResourcePath) && !this.behaviorXmlSet.ContainsKey(actorInfo.BtResourcePath))
        {
            actorPreloadTab2.behaviorXml.Add(new AssetLoadBase
            {
                assetPath = actorInfo.BtResourcePath
            });
            this.behaviorXmlSet.Add(actorInfo.BtResourcePath, true);
        }
        actorPreloadTab2.soundBanks = new List <AssetLoadBase>();
        this.AnalyseSoundBanks(ref actorPreloadTab2, ref actorInfo, ref actorServerData);
        list.Add(actorPreloadTab2);
        if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
        {
            this.CheckCallMonsterSkill(actorInfo, ref list, ref actorMeta, (int)actorServerData.SkinId);
        }
        else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Organ)
        {
            this.CheckOrganSoldierWave(ref list, ref actorMeta, inStaticData);
        }
    }
 public void Enter(AGE.Action _action)
 {
     this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
     this.lastTime     = 0;
     this.lastVelocity = this.lastLerpVelocity = this.velocity;
     this.stopCondtion = false;
     this.moveActor    = _action.GetActorHandle(this.targetId);
     if (this.moveActor != 0)
     {
         this.gravityControler = new AccelerateMotionControler();
         this.moveActor.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
         if (this.MoveType == ActorMoveType.Target)
         {
             this.tarActor = _action.GetActorHandle(this.destId);
             if (this.tarActor == 0)
             {
                 return;
             }
             this.destPosition = this.tarActor.handle.location;
             CActorInfo charInfo = this.tarActor.handle.CharInfo;
             if (charInfo != null)
             {
                 this.hitHeight = charInfo.iBulletHeight;
                 VInt3 a = this.moveActor.handle.location - this.destPosition;
                 a.y = 0;
                 a   = a.NormalizeTo(0x3e8);
                 this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 0x3e8L);
             }
             this.destPosition.y += this.hitHeight;
         }
         else if (this.MoveType == ActorMoveType.Directional)
         {
             VInt3 one = VInt3.one;
             if (this.skillContext == null)
             {
                 return;
             }
             PoolObjHandle <ActorRoot> originator = this.skillContext.Originator;
             if (originator == 0)
             {
                 return;
             }
             one = originator.handle.forward.RotateY(this.offsetDir.y);
             this.destPosition   = this.moveActor.handle.location + one.NormalizeTo(this.distance);
             this.destPosition.y = this.moveActor.handle.location.y;
         }
         else if (this.MoveType == ActorMoveType.Position)
         {
             this.destPosition = this.targetPosition;
         }
         if (this.bAdjustSpeed)
         {
             VInt3 num3 = this.destPosition - this.moveActor.handle.location;
             int   num4 = this.length - 100;
             num4          = (num4 > 0) ? num4 : this.length;
             this.velocity = (int)IntMath.Divide((long)(num3.magnitude2D * 0x3e8L), (long)num4);
         }
         if (this.gravity < 0)
         {
             if (this.velocity == 0)
             {
                 this.stopCondtion = true;
             }
             else
             {
                 VInt3 num5 = this.destPosition - this.moveActor.handle.location;
                 int   num6 = 0;
                 if (!this.shouldUseAcceleration)
                 {
                     num6 = (int)IntMath.Divide((long)(num5.magnitude2D * 0x3e8L), (long)this.velocity);
                 }
                 else
                 {
                     long velocity     = this.velocity;
                     long acceleration = this.acceleration;
                     long num9         = num5.magnitude2D;
                     long num10        = (velocity * velocity) + ((2L * acceleration) * num9);
                     num6 = (int)IntMath.Divide((long)((IntMath.Sqrt(num10) - velocity) * 0x3e8L), acceleration);
                     this.lastVelocity = this.lastLerpVelocity = this.velocity;
                 }
                 if (num6 == 0)
                 {
                     this.stopCondtion = true;
                 }
                 else
                 {
                     VInt num11;
                     if (PathfindingUtility.GetGroundY(this.destPosition, out num11))
                     {
                         this.gravityControler.InitMotionControler(num6, num11.i - this.moveActor.handle.location.y, this.gravity);
                     }
                     else
                     {
                         this.gravityControler.InitMotionControler(num6, 0, this.gravity);
                     }
                 }
             }
         }
     }
 }
Esempio n. 18
0
        private void EnterSpawnEye(AGE.Action _action, Track _track)
        {
            string prefabName;

            if (this.bUseSkin)
            {
                prefabName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance);
            }
            else
            {
                prefabName = this.prefabName;
            }
            VInt3                     zero           = VInt3.zero;
            VInt3                     forward        = VInt3.forward;
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            COM_PLAYERCAMP            com_playercamp = ((refParamObject == null) || (refParamObject.Originator == 0)) ? COM_PLAYERCAMP.COM_PLAYERCAMP_MID : refParamObject.Originator.handle.TheActorMeta.ActorCamp;
            GameObject                gameObject     = _action.GetGameObject(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle    = _action.GetActorHandle(this.parentId);
            PoolObjHandle <ActorRoot> handle2        = _action.GetActorHandle(this.objectSpaceId);

            if (handle2 != 0)
            {
                ActorRoot handle = handle2.handle;
                if (this.superTranslation)
                {
                    VInt3 num3 = VInt3.zero;
                    _action.refParams.GetRefParam("_BulletPos", ref num3);
                    zero = IntMath.Transform(num3, handle.forward, handle.location);
                }
                else if (this.modifyTranslation)
                {
                    zero = IntMath.Transform(this.translation, handle.forward, handle.location);
                }
                if (this.modifyDirection)
                {
                    forward = handle2.handle.forward;
                }
            }
            else if (this.bTargetPosition)
            {
                zero = this.translation + this.targetPosition;
                if ((this.modifyDirection && (refParamObject != null)) && (refParamObject.Originator != 0))
                {
                    forward = refParamObject.Originator.handle.forward;
                }
            }
            else
            {
                if (this.modifyTranslation)
                {
                    zero = this.translation;
                }
                if ((this.modifyDirection && (this.direction.x != 0)) && (this.direction.y != 0))
                {
                    forward = this.direction;
                    forward.NormalizeTo(0x3e8);
                }
            }
            if (this.targetId >= 0)
            {
                _action.ExpandGameObject(this.targetId);
                GameObject obj3 = _action.GetGameObject(this.targetId);
                if (this.recreateExisting && (obj3 != null))
                {
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, obj3);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, obj3);
                    }
                    ActorHelper.DetachActorRoot(obj3);
                    ActionManager.DestroyGameObject(obj3);
                    _action.SetGameObject(this.targetId, null);
                }
                GameObject obj4 = null;
                if (obj3 == null)
                {
                    ActorStaticData        actorData         = new ActorStaticData();
                    IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

                    ActorMeta actorMeta = new ActorMeta {
                        ActorType = ActorTypeDef.Actor_Type_EYE,
                        ActorCamp = com_playercamp,
                        ConfigId  = this.EyeCfgIdByMonster,
                        EnCId     = this.EyeCfgIdByMonster
                    };
                    actorDataProvider.GetActorStaticData(ref actorMeta, ref actorData);
                    CActorInfo info = null;
                    if (!string.IsNullOrEmpty(actorData.TheResInfo.ResPath))
                    {
                        CActorInfo actorInfo = CActorInfo.GetActorInfo(actorData.TheResInfo.ResPath, enResourceType.BattleScene);
                        if (actorInfo != null)
                        {
                            info = (CActorInfo)UnityEngine.Object.Instantiate(actorInfo);
                        }
                    }
                    PoolObjHandle <ActorRoot> handle3 = new PoolObjHandle <ActorRoot>();
                    if (info != null)
                    {
                        if ((refParamObject.Originator != 0) && !PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, zero))
                        {
                            zero = refParamObject.Originator.handle.location;
                        }
                        handle3 = Singleton <GameObjMgr> .instance.SpawnActorEx(null, ref actorMeta, zero, forward, false, true);

                        if (handle3 != 0)
                        {
                            this.actorRoot = handle3;
                            obj4           = handle3.handle.gameObject;
                            handle3.handle.InitActor();
                            this.CreateEye();
                            handle3.handle.PrepareFight();
                            handle3.handle.StartFight();
                        }
                    }
                    if (handle3 != 0)
                    {
                        if (obj4 == null)
                        {
                            throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                        }
                        obj4.transform.localScale = Vector3.one;
                        if (GameSettings.DynamicParticleLOD)
                        {
                            bool flag        = true;
                            int  particleLOD = GameSettings.ParticleLOD;
                            if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId))
                            {
                                flag = false;
                            }
                            if (!flag && (particleLOD > 1))
                            {
                                GameSettings.ParticleLOD = 1;
                            }
                            MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag;
                        }
                        this.actorRoot.handle.location = zero;
                        this.actorRoot.handle.forward  = forward;
                        if (this.actorRoot.handle.shape != null)
                        {
                            this.actorRoot.handle.shape.ConditionalUpdateShape();
                        }
                        if (this.actorRoot.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                        {
                            this.actorRoot.handle.TheActorMeta.ConfigId = this.EyeCfgIdByMonster;
                        }
                        if (refParamObject != null)
                        {
                            refParamObject.EffectPos = this.actorRoot.handle.location;
                            if (this.actorRoot.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                            {
                                DebugHelper.Assert(this.actorRoot.handle.TheActorMeta.ActorCamp == com_playercamp);
                                this.actorRoot.handle.TheActorMeta.ActorCamp = com_playercamp;
                            }
                        }
                    }
                }
            }
        }
 public void Enter(Action _action)
 {
     this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
     this.lastTime     = 0;
     this.lastVelocity = (this.lastLerpVelocity = this.velocity);
     this.stopCondtion = false;
     this.moveActor    = _action.GetActorHandle(this.targetId);
     if (!this.moveActor)
     {
         return;
     }
     this.gravityControler = new AccelerateMotionControler();
     this.xControler       = new xAxisAccelerateMotionControler();
     this.moveActor.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
     if (this.MoveType == ActorMoveType.Target)
     {
         if (this.bFindTargetByRotateBodyBullet)
         {
             _action.refParams.GetRefParam("FindEnemyActor", ref this.tarActor);
         }
         else
         {
             this.tarActor = _action.GetActorHandle(this.destId);
         }
         if (!this.tarActor)
         {
             return;
         }
         this.destPosition = this.tarActor.handle.location;
         CActorInfo charInfo = this.tarActor.handle.CharInfo;
         if (charInfo != null)
         {
             this.hitHeight = charInfo.iBulletHeight;
             VInt3 a = this.moveActor.handle.location - this.destPosition;
             a.y = 0;
             a   = a.NormalizeTo(1000);
             this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 1000L);
         }
         this.destPosition.y = this.destPosition.y + this.hitHeight;
     }
     else if (this.MoveType == ActorMoveType.Directional)
     {
         VInt3 vInt = VInt3.one;
         if (this.skillContext == null)
         {
             return;
         }
         PoolObjHandle <ActorRoot> originator = this.skillContext.Originator;
         if (!originator)
         {
             return;
         }
         if (this.bBulletUseDir)
         {
             _action.refParams.GetRefParam("_BulletUseDir", ref vInt);
         }
         else if (this.bUseIndicatorDir)
         {
             SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
             VInt3           vInt2;
             if (refParamObject != null && refParamObject.CalcAttackerDir(out vInt2, originator))
             {
                 vInt = vInt2;
             }
             else
             {
                 vInt = originator.handle.forward;
             }
         }
         else
         {
             vInt = originator.handle.forward;
         }
         this.moveActor.handle.forward  = vInt;
         this.moveActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt);
         vInt = vInt.RotateY(this.offsetDir.y);
         if (this.bResetMoveDistance)
         {
             int num = 0;
             _action.refParams.GetRefParam("_BulletRealFlyingTime", ref num);
             int num2 = num * this.velocity / 1000;
             this.distance = ((num2 > 0) ? num2 : this.distance);
         }
         this.destPosition   = this.moveActor.handle.location + vInt.NormalizeTo(this.distance);
         this.destPosition.y = this.moveActor.handle.location.y;
     }
     else if (this.MoveType == ActorMoveType.Position)
     {
         if (this.bReachDestStop)
         {
             this.destPosition = this.targetPosition;
         }
         else
         {
             VInt3 lhs = this.targetPosition - this.moveActor.handle.location;
             lhs.y             = 0;
             lhs               = lhs.NormalizeTo(1000);
             this.destPosition = this.moveActor.handle.location + lhs * (this.length * this.velocity / 1000);
             VInt vInt3;
             if (PathfindingUtility.GetGroundY(this.destPosition, out vInt3))
             {
                 this.destPosition.y = vInt3.i;
             }
         }
     }
     else if (this.MoveType == ActorMoveType.RotateBody)
     {
         this.originateActor = this.skillContext.Originator;
         if (!this.originateActor)
         {
             DebugHelper.Assert(false, "产生子弹的originateActor不能为空!!!");
             return;
         }
         this.rotateBodyBulletCount       = Mathf.Clamp(this.rotateBodyBulletCount, 1, 360);
         this.rotateBodyCurDirDegreeAngle = 360 / this.rotateBodyBulletCount * this.skillContext.BulletPos.x;
         VInt3 vInt4 = this.moveActor.handle.forward.RotateY(-this.rotateBodyCurDirDegreeAngle);
         this.moveActor.handle.forward  = vInt4;
         this.moveActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt4);
     }
     if (this.bAdjustSpeed)
     {
         VInt3 vInt5 = this.destPosition - this.moveActor.handle.location;
         int   num3  = this.length - 100;
         num3          = ((num3 <= 0) ? this.length : num3);
         this.velocity = (int)IntMath.Divide((long)vInt5.magnitude2D * 1000L, (long)num3);
     }
     if (this.gravity < 0)
     {
         if (this.velocity == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt3 vInt6 = this.destPosition - this.moveActor.handle.location;
         int   num4;
         if (!this.shouldUseAcceleration)
         {
             num4 = (int)IntMath.Divide((long)vInt6.magnitude2D * 1000L, (long)this.velocity);
         }
         else
         {
             long num5 = (long)this.velocity;
             long num6 = (long)this.acceleration;
             long num7 = (long)vInt6.magnitude2D;
             long a2   = num5 * num5 + 2L * num6 * num7;
             num4 = (int)IntMath.Divide(((long)IntMath.Sqrt(a2) - num5) * 1000L, num6);
             this.lastVelocity = (this.lastLerpVelocity = this.velocity);
         }
         if (num4 == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt vInt7;
         if (PathfindingUtility.GetGroundY(this.destPosition, out vInt7))
         {
             this.gravityControler.InitMotionControler(num4, vInt7.i - this.moveActor.handle.location.y, this.gravity);
         }
         else
         {
             this.gravityControler.InitMotionControler(num4, 0, this.gravity);
         }
     }
     if (this.bMoveOnXAxis)
     {
         this.zDirection   = this.destPosition - this.moveActor.handle.location;
         this.xDirection   = VInt3.Cross(VInt3.up, this.zDirection);
         this.zCurPosition = this.moveActor.handle.location;
         if (this.bReachDestStop)
         {
             int[]   array  = new int[3];
             VInt3[] array2 = new VInt3[]
             {
                 default(VInt3),
                 default(VInt3),
                 this.destPosition - this.moveActor.handle.location
             };
             array2[0] = array2[2];
             array2[1] = array2[2];
             array2[0].NormalizeTo(this.distanceZ0);
             array2[1].NormalizeTo(this.distanceZ1);
             for (int i = 0; i < array.Length; i++)
             {
                 if (!this.shouldUseAcceleration)
                 {
                     array[i] = (int)IntMath.Divide((long)array2[i].magnitude2D * 1000L, (long)this.velocity);
                 }
                 else
                 {
                     long num8  = (long)this.velocity;
                     long num9  = (long)this.acceleration;
                     long num10 = (long)array2[i].magnitude2D;
                     long a3    = num8 * num8 + 2L * num9 * num10;
                     array[i] = (int)IntMath.Divide(((long)IntMath.Sqrt(a3) - num8) * 1000L, num9);
                 }
             }
             if (array[2] > array[1] && array[1] > array[0] && array[0] > 0)
             {
                 this.xControler.InitMotionControler(array[0], array[1], array[2], this.distanceZ0, this.distanceZ1, this.distanceX);
                 int desPostion = this.xControler.getDesPostion();
                 this.xDestPosition = this.xDirection;
                 this.xDestPosition.NormalizeTo(Math.Abs(desPostion));
                 if (desPostion < 0)
                 {
                     this.xDestPosition = -this.xDestPosition;
                 }
             }
             else
             {
                 this.bMoveOnXAxis = false;
             }
         }
     }
 }
        public void ProcessInner(Action _action, Track _track, int delta)
        {
            if (this.MoveType == ActorMoveType.RotateBody)
            {
                int   num  = this.rotateBodyDegreeSpeed * delta / 1000;
                VInt3 vInt = this.moveActor.handle.forward.RotateY(-num);
                this.moveActor.handle.forward     = vInt;
                this.moveActor.handle.rotation    = Quaternion.LookRotation((Vector3)vInt);
                this.rotateBodyCurDirDegreeAngle += num;
                this.rotateBodyCurDirDegreeAngle %= 360;
                long    nom = (long)((float)this.rotateBodyCurDirDegreeAngle * 0.0174532924f * 1000f);
                VFactor f;
                VFactor f2;
                IntMath.sincos(out f, out f2, nom, 1000L);
                this.destPosition.x            = this.originateActor.handle.location.x + this.rotateBodyRadius * f2;
                this.destPosition.y            = this.rotateBodyHeight;
                this.destPosition.z            = this.originateActor.handle.location.z + this.rotateBodyRadius * f;
                this.moveDirection             = this.destPosition - this.moveActor.handle.location;
                this.lerpDirection             = this.moveDirection;
                this.moveActor.handle.location = this.destPosition;
            }
            else
            {
                VInt3 location = this.moveActor.handle.location;
                if (this.MoveType == ActorMoveType.Target && this.tarActor)
                {
                    this.destPosition = this.tarActor.handle.location;
                    if (this.tarActor && this.tarActor.handle.CharInfo != null)
                    {
                        CActorInfo charInfo = this.tarActor.handle.CharInfo;
                        this.hitHeight = charInfo.iBulletHeight;
                        VInt3 a = this.moveActor.handle.location - this.destPosition;
                        a.y = 0;
                        a   = a.NormalizeTo(1000);
                        this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 1000L);
                    }
                    this.destPosition.y = this.destPosition.y + this.hitHeight;
                }
                if (this.bMoveOnXAxis)
                {
                    this.moveDirection = this.destPosition - this.zCurPosition;
                }
                else
                {
                    this.moveDirection = this.destPosition - location;
                }
                this.lerpDirection = this.moveDirection;
                if (this.bMoveRotate && !this.bMoveOnXAxis)
                {
                    this.RotateMoveBullet(this.moveDirection);
                }
                int num2;
                if (!this.shouldUseAcceleration)
                {
                    num2 = this.velocity * delta / 1000;
                }
                else
                {
                    long num3 = (long)this.lastVelocity * (long)delta + (long)this.acceleration * (long)delta * (long)delta / 2L / 1000L;
                    num3 /= 1000L;
                    num2  = (int)num3;
                    this.lastVelocity += this.acceleration * delta / 1000;
                }
                if ((long)num2 * (long)num2 >= this.moveDirection.sqrMagnitudeLong2D && this.bReachDestStop)
                {
                    int magnitude2D = (this.destPosition - this.moveActor.handle.location).magnitude2D;
                    if (this.bMoveOnXAxis)
                    {
                        this.destPosition += this.xDestPosition;
                    }
                    this.moveActor.handle.location = this.destPosition;
                    this.stopCondtion = true;
                    if (this.moveActor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Bullet)
                    {
                        BulletWrapper bulletWrapper = this.moveActor.handle.ActorControl as BulletWrapper;
                        if (bulletWrapper != null && bulletWrapper.GetMoveCollisiong())
                        {
                            bulletWrapper.SetMoveDelta(magnitude2D);
                        }
                    }
                }
                else
                {
                    VInt3 vInt2;
                    if (this.gravity < 0)
                    {
                        this.moveDirection.y = 0;
                        vInt2    = location + this.moveDirection.NormalizeTo(num2);
                        vInt2.y += this.gravityControler.GetMotionDeltaDistance(delta);
                        VInt vInt3;
                        if (PathfindingUtility.GetGroundY(this.destPosition, out vInt3) && vInt2.y < vInt3.i)
                        {
                            vInt2.y = vInt3.i;
                        }
                    }
                    else
                    {
                        vInt2 = location + this.moveDirection.NormalizeTo(num2);
                    }
                    if (this.bMoveOnXAxis)
                    {
                        this.zCurPosition += this.moveDirection.NormalizeTo(num2);
                        int   motionDeltaDistance = this.xControler.GetMotionDeltaDistance(delta);
                        VInt3 vInt4 = this.xDirection;
                        vInt4.NormalizeTo(Math.Abs(motionDeltaDistance));
                        if (motionDeltaDistance < 0)
                        {
                            vInt4 = -vInt4;
                        }
                        vInt2 += vInt4;
                        if (this.bMoveRotate)
                        {
                            VInt3 dir = vInt2 - location;
                            this.RotateMoveBullet(dir);
                        }
                    }
                    if (this.moveActor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Bullet)
                    {
                        BulletWrapper bulletWrapper2 = this.moveActor.handle.ActorControl as BulletWrapper;
                        if (bulletWrapper2 != null && bulletWrapper2.GetMoveCollisiong())
                        {
                            bulletWrapper2.SetMoveDelta(num2);
                        }
                    }
                    this.moveActor.handle.location = vInt2;
                }
            }
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (refParamObject != null)
            {
                refParamObject.EffectPos = this.moveActor.handle.location;
                refParamObject.EffectDir = this.moveDirection;
            }
        }
Esempio n. 21
0
 public void Enter(Action _action)
 {
     this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
     this.lastTime     = 0;
     this.lastVelocity = (this.lastLerpVelocity = this.velocity);
     this.stopCondtion = false;
     this.moveActor    = _action.GetActorHandle(this.targetId);
     if (!this.moveActor)
     {
         return;
     }
     this.gravityControler = new AccelerateMotionControler();
     this.moveActor.get_handle().ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
     if (this.MoveType == ActorMoveType.Target)
     {
         this.tarActor = _action.GetActorHandle(this.destId);
         if (!this.tarActor)
         {
             return;
         }
         this.destPosition = this.tarActor.get_handle().location;
         CActorInfo charInfo = this.tarActor.get_handle().CharInfo;
         if (charInfo != null)
         {
             this.hitHeight = charInfo.iBulletHeight;
             VInt3 vInt = this.moveActor.get_handle().location - this.destPosition;
             vInt.y             = 0;
             vInt               = vInt.NormalizeTo(1000);
             this.destPosition += IntMath.Divide(vInt, (long)charInfo.iCollisionSize.x, 1000L);
         }
         this.destPosition.y = this.destPosition.y + this.hitHeight;
     }
     else if (this.MoveType == ActorMoveType.Directional)
     {
         VInt3 vInt2 = VInt3.one;
         if (this.skillContext == null)
         {
             return;
         }
         PoolObjHandle <ActorRoot> originator = this.skillContext.Originator;
         if (!originator)
         {
             return;
         }
         if (this.bBulletUseDir)
         {
             _action.refParams.GetRefParam("_BulletUseDir", ref vInt2);
         }
         else if (this.bUseIndicatorDir)
         {
             SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
             VInt3           vInt3;
             if (refParamObject != null && refParamObject.CalcAttackerDir(out vInt3, originator))
             {
                 vInt2 = vInt3;
             }
             else
             {
                 vInt2 = originator.get_handle().forward;
             }
         }
         else
         {
             vInt2 = originator.get_handle().forward;
         }
         vInt2 = vInt2.RotateY(this.offsetDir.y);
         if (this.bResetMoveDistance)
         {
             int num = 0;
             _action.refParams.GetRefParam("_BulletRealFlyingTime", ref num);
             int num2 = num * this.velocity / 1000;
             this.distance = ((num2 <= 0) ? this.distance : num2);
         }
         this.destPosition   = this.moveActor.get_handle().location + vInt2.NormalizeTo(this.distance);
         this.destPosition.y = this.moveActor.get_handle().location.y;
     }
     else if (this.MoveType == ActorMoveType.Position)
     {
         if (this.bReachDestStop)
         {
             this.destPosition = this.targetPosition;
         }
         else
         {
             VInt3 vInt4 = this.targetPosition - this.moveActor.get_handle().location;
             vInt4.y           = 0;
             vInt4             = vInt4.NormalizeTo(1000);
             this.destPosition = this.moveActor.get_handle().location + vInt4 * (this.length * this.velocity / 1000);
             VInt vInt5;
             if (PathfindingUtility.GetGroundY(this.destPosition, out vInt5))
             {
                 this.destPosition.y = vInt5.i;
             }
         }
     }
     if (this.bAdjustSpeed)
     {
         VInt3 vInt6 = this.destPosition - this.moveActor.get_handle().location;
         int   num3  = this.length - 100;
         num3          = ((num3 > 0) ? num3 : this.length);
         this.velocity = (int)IntMath.Divide((long)vInt6.get_magnitude2D() * 1000L, (long)num3);
     }
     if (this.gravity < 0)
     {
         if (this.velocity == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt3 vInt7 = this.destPosition - this.moveActor.get_handle().location;
         int   num4;
         if (!this.shouldUseAcceleration)
         {
             num4 = (int)IntMath.Divide((long)vInt7.get_magnitude2D() * 1000L, (long)this.velocity);
         }
         else
         {
             long num5 = (long)this.velocity;
             long num6 = (long)this.acceleration;
             long num7 = (long)vInt7.get_magnitude2D();
             long num8 = num5 * num5 + 2L * num6 * num7;
             num4 = (int)IntMath.Divide(((long)IntMath.Sqrt(num8) - num5) * 1000L, num6);
             this.lastVelocity = (this.lastLerpVelocity = this.velocity);
         }
         if (num4 == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt vInt8;
         if (PathfindingUtility.GetGroundY(this.destPosition, out vInt8))
         {
             this.gravityControler.InitMotionControler(num4, vInt8.i - this.moveActor.get_handle().location.y, this.gravity);
         }
         else
         {
             this.gravityControler.InitMotionControler(num4, 0, this.gravity);
         }
     }
 }
Esempio n. 22
0
        public void ProcessInner(Action _action, Track _track, int delta)
        {
            VInt3 location = this.moveActor.get_handle().location;

            if (this.MoveType == ActorMoveType.Target && this.tarActor)
            {
                this.destPosition = this.tarActor.get_handle().location;
                if (this.tarActor && this.tarActor.get_handle().CharInfo != null)
                {
                    CActorInfo charInfo = this.tarActor.get_handle().CharInfo;
                    this.hitHeight = charInfo.iBulletHeight;
                    VInt3 vInt = this.moveActor.get_handle().location - this.destPosition;
                    vInt.y             = 0;
                    vInt               = vInt.NormalizeTo(1000);
                    this.destPosition += IntMath.Divide(vInt, (long)charInfo.iCollisionSize.x, 1000L);
                }
                this.destPosition.y = this.destPosition.y + this.hitHeight;
            }
            this.moveDirection = this.destPosition - location;
            this.lerpDirection = this.moveDirection;
            if (this.bMoveRotate)
            {
                this.RotateMoveBullet(this.moveDirection);
            }
            int num;

            if (!this.shouldUseAcceleration)
            {
                num = this.velocity * delta / 1000;
            }
            else
            {
                long num2 = (long)this.lastVelocity * (long)delta + (long)this.acceleration * (long)delta * (long)delta / 2L / 1000L;
                num2 /= 1000L;
                num   = (int)num2;
                this.lastVelocity += this.acceleration * delta / 1000;
            }
            if ((long)num * (long)num >= this.moveDirection.get_sqrMagnitudeLong2D() && this.bReachDestStop)
            {
                int magnitude2D = (this.destPosition - this.moveActor.get_handle().location).get_magnitude2D();
                this.moveActor.get_handle().location = this.destPosition;
                this.stopCondtion = true;
                if (this.moveActor.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Bullet)
                {
                    BulletWrapper bulletWrapper = this.moveActor.get_handle().ActorControl as BulletWrapper;
                    if (bulletWrapper != null && bulletWrapper.GetMoveCollisiong())
                    {
                        bulletWrapper.SetMoveDelta(magnitude2D);
                    }
                }
            }
            else
            {
                VInt3 location2;
                if (this.gravity < 0)
                {
                    this.moveDirection.y = 0;
                    location2            = location + this.moveDirection.NormalizeTo(num);
                    location2.y         += this.gravityControler.GetMotionDeltaDistance(delta);
                    VInt vInt2;
                    if (PathfindingUtility.GetGroundY(this.destPosition, out vInt2) && location2.y < vInt2.i)
                    {
                        location2.y = vInt2.i;
                    }
                }
                else
                {
                    location2 = location + this.moveDirection.NormalizeTo(num);
                }
                if (this.moveActor.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Bullet)
                {
                    BulletWrapper bulletWrapper2 = this.moveActor.get_handle().ActorControl as BulletWrapper;
                    if (bulletWrapper2 != null && bulletWrapper2.GetMoveCollisiong())
                    {
                        bulletWrapper2.SetMoveDelta(num);
                    }
                }
                this.moveActor.get_handle().location = location2;
            }
            SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");

            if (refParamObject != null)
            {
                refParamObject.EffectPos = this.moveActor.get_handle().location;
                refParamObject.EffectDir = this.moveDirection;
            }
        }
Esempio n. 23
0
        private void EnterSpawnEye(Action _action, Track _track)
        {
            if (this.bUseSkin)
            {
                string resourceName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance);
            }
            else
            {
                string resourceName = this.prefabName;
            }
            VInt3                     vInt           = VInt3.zero;
            VInt3                     forward        = VInt3.forward;
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            COM_PLAYERCAMP            cOM_PLAYERCAMP = (refParamObject == null || !refParamObject.Originator) ? 0 : refParamObject.Originator.get_handle().TheActorMeta.ActorCamp;
            GameObject                gameObject     = _action.GetGameObject(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle    = _action.GetActorHandle(this.parentId);
            PoolObjHandle <ActorRoot> actorHandle2   = _action.GetActorHandle(this.objectSpaceId);

            if (actorHandle2)
            {
                ActorRoot handle = actorHandle2.get_handle();
                if (this.superTranslation)
                {
                    VInt3 zero = VInt3.zero;
                    _action.refParams.GetRefParam("_BulletPos", ref zero);
                    vInt = IntMath.Transform(zero, handle.forward, handle.location);
                }
                else if (this.modifyTranslation)
                {
                    vInt = IntMath.Transform(this.translation, handle.forward, handle.location);
                }
                if (this.modifyDirection)
                {
                    forward = actorHandle2.get_handle().forward;
                }
            }
            else if (this.bTargetPosition)
            {
                vInt = this.translation + this.targetPosition;
                if (this.modifyDirection && refParamObject != null && refParamObject.Originator)
                {
                    forward = refParamObject.Originator.get_handle().forward;
                }
            }
            else
            {
                if (this.modifyTranslation)
                {
                    vInt = this.translation;
                }
                if (this.modifyDirection && this.direction.x != 0 && this.direction.y != 0)
                {
                    forward = this.direction;
                    forward.NormalizeTo(1000);
                }
            }
            if (this.targetId >= 0)
            {
                _action.ExpandGameObject(this.targetId);
                GameObject gameObject2 = _action.GetGameObject(this.targetId);
                if (this.recreateExisting && gameObject2 != null)
                {
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject2);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject2);
                    }
                    ActorHelper.DetachActorRoot(gameObject2);
                    ActionManager.DestroyGameObject(gameObject2);
                    _action.SetGameObject(this.targetId, null);
                }
                GameObject gameObject3 = null;
                if (!(gameObject2 == null))
                {
                    return;
                }
                ActorStaticData        actorStaticData   = default(ActorStaticData);
                IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

                ActorMeta actorMeta  = default(ActorMeta);
                ActorMeta actorMeta2 = actorMeta;
                actorMeta2.ActorType = ActorTypeDef.Actor_Type_EYE;
                actorMeta2.ActorCamp = cOM_PLAYERCAMP;
                actorMeta2.ConfigId  = this.EyeCfgIdByMonster;
                actorMeta2.EnCId     = this.EyeCfgIdByMonster;
                actorMeta            = actorMeta2;
                actorDataProvider.GetActorStaticData(ref actorMeta, ref actorStaticData);
                CActorInfo exists = null;
                if (!string.IsNullOrEmpty(actorStaticData.TheResInfo.ResPath))
                {
                    CActorInfo actorInfo = CActorInfo.GetActorInfo(actorStaticData.TheResInfo.ResPath, 0);
                    if (actorInfo != null)
                    {
                        exists = (CActorInfo)Object.Instantiate(actorInfo);
                    }
                }
                PoolObjHandle <ActorRoot> poolObjHandle = default(PoolObjHandle <ActorRoot>);
                if (exists)
                {
                    if (refParamObject.Originator && !PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), vInt) && !Singleton <GameFowManager> .get_instance().m_pFieldObj.FindNearestNotBrickFromWorldLocNonFow(ref vInt, refParamObject.Originator.get_handle()))
                    {
                        vInt = refParamObject.Originator.get_handle().location;
                    }
                    poolObjHandle = Singleton <GameObjMgr> .get_instance().SpawnActorEx(null, ref actorMeta, vInt, forward, false, true);

                    if (poolObjHandle)
                    {
                        this.actorRoot = poolObjHandle;
                        gameObject3    = poolObjHandle.get_handle().gameObject;
                        poolObjHandle.get_handle().InitActor();
                        this.CreateEye();
                        poolObjHandle.get_handle().PrepareFight();
                        poolObjHandle.get_handle().StartFight();
                    }
                }
                if (!poolObjHandle)
                {
                    return;
                }
                if (!gameObject3)
                {
                    throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                }
                gameObject3.transform.localScale = Vector3.one;
                if (GameSettings.DynamicParticleLOD)
                {
                    bool flag        = true;
                    int  particleLOD = GameSettings.ParticleLOD;
                    if (refParamObject != null && refParamObject.Originator && refParamObject.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)
                    {
                        flag = false;
                    }
                    if (!flag && particleLOD > 1)
                    {
                        GameSettings.ParticleLOD = 1;
                    }
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag;
                }
                this.actorRoot.get_handle().location = vInt;
                this.actorRoot.get_handle().forward  = forward;
                if (this.actorRoot.get_handle().shape != null)
                {
                    this.actorRoot.get_handle().shape.ConditionalUpdateShape();
                }
                if (this.actorRoot.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                {
                    this.actorRoot.get_handle().TheActorMeta.ConfigId = this.EyeCfgIdByMonster;
                }
                if (refParamObject != null)
                {
                    refParamObject.EffectPos = this.actorRoot.get_handle().location;
                    if (this.actorRoot.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE)
                    {
                        DebugHelper.Assert(this.actorRoot.get_handle().TheActorMeta.ActorCamp == cOM_PLAYERCAMP);
                        this.actorRoot.get_handle().TheActorMeta.ActorCamp = cOM_PLAYERCAMP;
                    }
                }
                SpawnEyeEventParam spawnEyeEventParam = new SpawnEyeEventParam(refParamObject.Originator, vInt);
                Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnEyeEventParam>(GameSkillEventDef.Event_SpawnEye, refParamObject.Originator, ref spawnEyeEventParam, GameSkillEventChannel.Channel_HostCtrlActor);
            }
        }
Esempio n. 24
0
    public void AddPreloadActor(ref List <ActorPreloadTab> list, ref ActorMeta actorMeta, float spawnCnt, int ownerSkinID = 0)
    {
        for (int i = 0; i < list.Count; i++)
        {
            ActorPreloadTab tab = list[i];
            if (tab.theActor.ConfigId != actorMeta.ConfigId)
            {
                continue;
            }
            if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
            {
                if (this.GetActorMarkID(actorMeta) == tab.MarkID)
                {
                    goto Label_0085;
                }
                continue;
            }
            if ((actorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) && (spawnCnt > 0f))
            {
                tab.spawnCnt += spawnCnt;
                list[i]       = tab;
            }
Label_0085:
            retCnt++;
            return;
        }
        ActorStaticData        actorData         = new ActorStaticData();
        IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider);

        actorDataProvider.GetActorStaticData(ref actorMeta, ref actorData);
        ActorServerData data2 = new ActorServerData();

        Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.ServerDataProvider).GetActorServerData(ref actorMeta, ref data2);

        CActorInfo actorInfo = CActorInfo.GetActorInfo(actorData.TheResInfo.ResPath, enResourceType.BattleScene);

        if (actorInfo != null)
        {
            ActorPreloadTab loadInfo = new ActorPreloadTab {
                theActor = actorMeta
            };
            loadInfo.modelPrefab.assetPath    = actorInfo.GetArtPrefabName((ownerSkinID == 0) ? ((int)data2.SkinId) : ownerSkinID, -1);
            loadInfo.modelPrefab.nInstantiate = 1;
            loadInfo.spawnCnt      = spawnCnt;
            loadInfo.MarkID        = this.GetActorMarkID(actorMeta);
            loadInfo.ageActions    = new List <AssetLoadBase>();
            loadInfo.parPrefabs    = new List <AssetLoadBase>();
            loadInfo.mesPrefabs    = new List <AssetLoadBase>();
            loadInfo.spritePrefabs = new List <AssetLoadBase>();
            loadInfo.soundBanks    = new List <AssetLoadBase>();
            loadInfo.behaviorXml   = new List <AssetLoadBase>();
            ActorStaticSkillData skillData = new ActorStaticSkillData();
            for (int j = 0; j < 7; j++)
            {
                actorDataProvider.GetActorStaticSkillData(ref actorMeta, (ActorSkillSlot)j, ref skillData);
                if (skillData.SkillId != 0)
                {
                    this.AnalyseSkill(ref loadInfo, skillData.SkillId);
                    this.AnalysePassiveSkill(ref loadInfo, skillData.PassiveSkillId);
                }
            }
            if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
            {
                ResTalentHero dataByKey = GameDataMgr.talentHero.GetDataByKey((uint)actorMeta.ConfigId);
                if (dataByKey != null)
                {
                    this.AnalyseHeroTalent(ref loadInfo, dataByKey);
                }
            }
            else if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Monster)
            {
                ActorStaticData data4 = new ActorStaticData();
                Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider).GetActorStaticData(ref actorMeta, ref data4);

                int randomPassiveSkillRule = data4.TheBaseAttribute.RandomPassiveSkillRule;
                if ((randomPassiveSkillRule > 0) && !this.randomSkillCheckerSet.ContainsKey(randomPassiveSkillRule))
                {
                    this.randomSkillCheckerSet.Add(randomPassiveSkillRule, true);
                    ResRandomSkillPassiveRule rule = GameDataMgr.randomSkillPassiveDatabin.GetDataByKey(randomPassiveSkillRule);
                    if ((rule.astRandomSkillPassiveID1 != null) && (rule.astRandomSkillPassiveID1.Length > 0))
                    {
                        for (int k = 0; k < rule.astRandomSkillPassiveID1.Length; k++)
                        {
                            this.AnalysePassiveSkill(ref loadInfo, rule.astRandomSkillPassiveID1[k].iParam);
                        }
                    }
                    if ((rule.astRandomSkillPassiveID2 != null) && (rule.astRandomSkillPassiveID2.Length > 0))
                    {
                        for (int m = 0; m < rule.astRandomSkillPassiveID2.Length; m++)
                        {
                            this.AnalysePassiveSkill(ref loadInfo, rule.astRandomSkillPassiveID2[m].iParam);
                        }
                    }
                }
            }
            if (!string.IsNullOrEmpty(actorInfo.deadAgePath))
            {
                AssetLoadBase item = new AssetLoadBase {
                    assetPath = actorInfo.deadAgePath
                };
                loadInfo.ageActions.Add(item);
            }
            if (!string.IsNullOrEmpty(actorInfo.BtResourcePath) && !this.behaviorXmlSet.ContainsKey(actorInfo.BtResourcePath))
            {
                AssetLoadBase base3 = new AssetLoadBase {
                    assetPath = actorInfo.BtResourcePath
                };
                loadInfo.behaviorXml.Add(base3);
                this.behaviorXmlSet.Add(actorInfo.BtResourcePath, true);
            }
            loadInfo.soundBanks = new List <AssetLoadBase>();
            this.AnalyseSoundBanks(ref loadInfo, ref actorInfo, ref data2);
            list.Add(loadInfo);
            if (actorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
            {
                this.CheckCallMonsterSkill(actorInfo, ref list, ref actorMeta, (int)data2.SkinId);
            }
        }
    }
Esempio n. 25
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);
                }
            }
        }
Esempio n. 26
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);
                            }
                        }
                    }
                }
            }
        }
        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);
                }
            }
        }