Пример #1
0
        public override void Process(Action _action, Track _track)
        {
            if (MonoSingleton <Reconnection> .GetInstance().isProcessingRelayRecover)
            {
                return;
            }
            SkillUseContext skillUseContext = null;
            Vector3         vector          = this.bindPosOffset;
            Quaternion      quaternion      = this.bindRotOffset;
            GameObject      gameObject      = _action.GetGameObject(this.targetId);
            GameObject      gameObject2     = _action.GetGameObject(this.objectSpaceId);
            Transform       transform       = null;
            Transform       transform2      = null;

            if (this.bindPointName.get_Length() == 0)
            {
                if (gameObject != null)
                {
                    transform = gameObject.transform;
                }
                else if (gameObject2 != null)
                {
                    transform2 = gameObject2.transform;
                }
            }
            else
            {
                Transform transform3 = null;
                if (gameObject != null)
                {
                    GameObject gameObject3 = SubObject.FindSubObject(gameObject, this.bindPointName);
                    if (gameObject3 != null)
                    {
                        transform3 = gameObject3.transform;
                    }
                    if (transform3 != null)
                    {
                        transform = transform3;
                    }
                    else if (gameObject != null)
                    {
                        transform = gameObject.transform;
                    }
                }
                else if (gameObject2 != null)
                {
                    GameObject gameObject3 = SubObject.FindSubObject(gameObject2, this.bindPointName);
                    if (gameObject3 != null)
                    {
                        transform3 = gameObject3.transform;
                    }
                    if (transform3 != null)
                    {
                        transform2 = transform3;
                    }
                    else if (gameObject != null)
                    {
                        transform2 = gameObject2.transform;
                    }
                }
            }
            if (this.bBulletPos)
            {
                VInt3 zero = VInt3.zero;
                _action.refParams.GetRefParam("_BulletPos", ref zero);
                vector     = (Vector3)zero;
                quaternion = Quaternion.identity;
                if (this.bBulletDir)
                {
                    VInt3 zero2 = VInt3.zero;
                    if (_action.refParams.GetRefParam("_BulletDir", ref zero2))
                    {
                        quaternion = Quaternion.LookRotation((Vector3)zero2);
                    }
                }
            }
            else if (transform != null)
            {
                vector     = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                quaternion = transform.rotation * this.bindRotOffset;
            }
            else if (transform2 != null)
            {
                if (gameObject2 != null)
                {
                    PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.objectSpaceId);
                    if (actorHandle)
                    {
                        vector     = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, actorHandle.get_handle().forward, actorHandle.get_handle().location);
                        quaternion = Quaternion.LookRotation((Vector3)actorHandle.get_handle().forward) * this.bindRotOffset;
                    }
                }
                else
                {
                    vector     = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                    quaternion = transform2.rotation * this.bindRotOffset;
                }
                if (this.bBulletDir)
                {
                    VInt3 zero3 = VInt3.zero;
                    if (_action.refParams.GetRefParam("_BulletDir", ref zero3))
                    {
                        quaternion  = Quaternion.LookRotation((Vector3)zero3);
                        quaternion *= this.bindRotOffset;
                    }
                }
                else if (this.bBullerPosDir)
                {
                    skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
                    if (skillUseContext != null)
                    {
                        PoolObjHandle <ActorRoot> originator = skillUseContext.Originator;
                        if (originator)
                        {
                            Vector3 a = transform2.position;
                            if (gameObject2 != null)
                            {
                                PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.objectSpaceId);
                                if (actorHandle2)
                                {
                                    a = (Vector3)actorHandle2.get_handle().location;
                                }
                            }
                            Vector3 forward = a - (Vector3)originator.get_handle().location;
                            quaternion  = Quaternion.LookRotation(forward);
                            quaternion *= this.bindRotOffset;
                        }
                    }
                }
            }
            if (this.bEnableOptCull && transform2 && transform2.gameObject.layer == LayerMask.NameToLayer("Hide") && !FogOfWar.enable)
            {
                return;
            }
            if (this.bEnableOptCull && MonoSingleton <GlobalConfig> .get_instance().bEnableParticleCullOptimize&& !MonoSingleton <CameraSystem> .get_instance().CheckVisiblity(new Bounds(vector, new Vector3((float)this.extend, (float)this.extend, (float)this.extend))))
            {
                return;
            }
            bool   flag = false;
            string prefabName;

            if (this.bUseSkin)
            {
                prefabName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance);
            }
            else
            {
                prefabName = this.resourceName;
            }
            if (skillUseContext == null)
            {
                skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            }
            bool flag2       = true;
            int  particleLOD = GameSettings.ParticleLOD;

            if (GameSettings.DynamicParticleLOD)
            {
                if (skillUseContext != null && skillUseContext.Originator && skillUseContext.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)
                {
                    flag2 = false;
                }
                if (!flag2 && particleLOD > 1)
                {
                    GameSettings.ParticleLOD = 1;
                }
                MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2;
            }
            this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, vector, quaternion, out flag);

            if (GameSettings.DynamicParticleLOD)
            {
                MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
            }
            if (this.particleObject == null)
            {
                if (GameSettings.DynamicParticleLOD)
                {
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2;
                }
                this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, vector, quaternion, out flag);

                if (GameSettings.DynamicParticleLOD)
                {
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
                }
                if (this.particleObject == null)
                {
                    if (GameSettings.DynamicParticleLOD)
                    {
                        GameSettings.ParticleLOD = particleLOD;
                    }
                    return;
                }
            }
            if (GameSettings.DynamicParticleLOD)
            {
                GameSettings.ParticleLOD = particleLOD;
            }
            if (!this.particleObject)
            {
                return;
            }
            ParticleHelper.IncParticleActiveNumber();
            if (transform != null)
            {
                PoolObjHandle <ActorRoot> poolObjHandle = (!(transform.gameObject == gameObject)) ? ActorHelper.GetActorRoot(transform.gameObject) : _action.GetActorHandle(this.targetId);
                if (poolObjHandle && poolObjHandle.get_handle().ActorMesh)
                {
                    this.particleObject.transform.parent = poolObjHandle.get_handle().ActorMesh.transform;
                }
                else
                {
                    this.particleObject.transform.parent = transform.parent;
                    if (poolObjHandle && poolObjHandle.get_handle().TheActorMeta.ActorCamp != Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp&& FogOfWar.enable)
                    {
                        if (poolObjHandle.get_handle().HorizonMarker != null)
                        {
                            poolObjHandle.get_handle().HorizonMarker.AddSubParObj(this.particleObject);
                        }
                        else
                        {
                            BulletWrapper bulletWrapper = poolObjHandle.get_handle().ActorControl as BulletWrapper;
                            if (bulletWrapper != null)
                            {
                                bulletWrapper.AddSubParObj(this.particleObject);
                            }
                        }
                    }
                }
            }
            string text = "Particles";

            if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide"))
            {
                text = "Hide";
            }
            if (transform == null && transform2 != null && FogOfWar.enable)
            {
                PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(transform2.gameObject);
                if (actorRoot && actorRoot.get_handle().TheActorMeta.ActorCamp != Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp)
                {
                    if (transform2.gameObject.layer == LayerMask.NameToLayer("Hide"))
                    {
                        text = "Hide";
                    }
                    PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.VirtualAttachBulletId);
                    Singleton <GameFowManager> .get_instance().m_collector.AddVirtualParentParticle(this.particleObject, actorHandle3, this.bUseAttachBulletShape);
                }
            }
            MMGame_Math.SetLayer(this.particleObject, text, false);
            if (flag)
            {
                ParticleHelper.Init(this.particleObject, this.scaling);
            }
            Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(this.particleObject, Mathf.Max(_action.length, (int)(this.lifeTime * 1000f)), new CGameObjectPool.OnDelayRecycleDelegate(TriggerParticleTick.OnRecycleTickObj));

            if (this.applyActionSpeedToParticle && this.particleObject != null)
            {
                _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject);
            }
        }
        public override void Process(Action _action, Track _track)
        {
            if (MonoSingleton <Reconnection> .GetInstance().isProcessingRelayRecover)
            {
                return;
            }
            SkillUseContext skillUseContext = null;
            Vector3         vector          = this.bindPosOffset;
            Quaternion      quaternion      = this.bindRotOffset;
            GameObject      gameObject      = _action.GetGameObject(this.targetId);
            GameObject      gameObject2     = _action.GetGameObject(this.objectSpaceId);
            Transform       transform       = null;
            Transform       transform2      = null;

            if (this.bindPointName.get_Length() == 0)
            {
                if (gameObject != null)
                {
                    transform = gameObject.transform;
                }
                else if (gameObject2 != null)
                {
                    transform2 = gameObject2.transform;
                }
            }
            else
            {
                Transform transform3 = null;
                if (gameObject != null)
                {
                    GameObject gameObject3 = SubObject.FindSubObject(gameObject, this.bindPointName);
                    if (gameObject3 != null)
                    {
                        transform3 = gameObject3.transform;
                    }
                    if (transform3 != null)
                    {
                        transform = transform3;
                    }
                    else if (gameObject != null)
                    {
                        transform = gameObject.transform;
                    }
                }
                else if (gameObject2 != null)
                {
                    GameObject gameObject4 = SubObject.FindSubObject(gameObject2, this.bindPointName);
                    if (gameObject4 != null)
                    {
                        transform3 = gameObject4.transform;
                    }
                    if (transform3 != null)
                    {
                        transform2 = transform3;
                    }
                    else if (gameObject != null)
                    {
                        transform2 = gameObject2.transform;
                    }
                }
            }
            if (this.bBulletPos)
            {
                VInt3 zero = VInt3.zero;
                _action.refParams.GetRefParam("_BulletPos", ref zero);
                vector     = (Vector3)zero;
                quaternion = Quaternion.identity;
                if (this.bBulletDir)
                {
                    VInt3 zero2 = VInt3.zero;
                    if (_action.refParams.GetRefParam("_BulletDir", ref zero2))
                    {
                        quaternion = Quaternion.LookRotation((Vector3)zero2);
                    }
                }
            }
            else if (transform != null)
            {
                vector     = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                quaternion = transform.rotation * this.bindRotOffset;
            }
            else if (transform2 != null)
            {
                if (gameObject2 != null)
                {
                    PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.objectSpaceId);
                    if (actorHandle)
                    {
                        vector     = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, actorHandle.handle.forward, actorHandle.handle.location);
                        quaternion = Quaternion.LookRotation((Vector3)actorHandle.handle.forward) * this.bindRotOffset;
                    }
                }
                else
                {
                    vector     = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                    quaternion = transform2.rotation * this.bindRotOffset;
                }
                if (this.bBulletDir)
                {
                    VInt3 zero3 = VInt3.zero;
                    if (_action.refParams.GetRefParam("_BulletDir", ref zero3))
                    {
                        quaternion  = Quaternion.LookRotation((Vector3)zero3);
                        quaternion *= this.bindRotOffset;
                    }
                }
                else if (this.bBullerPosDir)
                {
                    skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
                    if (skillUseContext != null)
                    {
                        PoolObjHandle <ActorRoot> originator = skillUseContext.Originator;
                        if (originator)
                        {
                            Vector3 a = transform2.position;
                            if (gameObject2 != null)
                            {
                                PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.objectSpaceId);
                                if (actorHandle2)
                                {
                                    a = (Vector3)actorHandle2.handle.location;
                                }
                            }
                            Vector3 forward = a - (Vector3)originator.handle.location;
                            quaternion  = Quaternion.LookRotation(forward);
                            quaternion *= this.bindRotOffset;
                        }
                    }
                }
            }
            if (this.bUseIndicatorDir)
            {
                skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
                if (skillUseContext != null)
                {
                    PoolObjHandle <ActorRoot> originator2 = skillUseContext.Originator;
                    VInt3 ob;
                    if (originator2 && skillUseContext.CalcAttackerDir(out ob, originator2))
                    {
                        quaternion  = Quaternion.LookRotation((Vector3)ob);
                        quaternion *= this.bindRotOffset;
                    }
                }
            }
            if (this.bEnableOptCull && transform2 && transform2.gameObject.layer == LayerMask.NameToLayer("Hide") && !FogOfWar.enable)
            {
                return;
            }
            if (this.bEnableOptCull && MonoSingleton <GlobalConfig> .instance.bEnableParticleCullOptimize && !MonoSingleton <CameraSystem> .instance.CheckVisiblity(new Bounds(vector, new Vector3((float)this.extend, (float)this.extend, (float)this.extend))))
            {
                return;
            }
            bool   flag = false;
            string prefabName;

            if (this.bUseSkin)
            {
                prefabName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance);
            }
            else
            {
                prefabName = this.resourceName;
            }
            if (skillUseContext == null)
            {
                skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            }
            bool flag2       = true;
            int  particleLOD = GameSettings.ParticleLOD;

            if (GameSettings.DynamicParticleLOD)
            {
                if (skillUseContext != null && skillUseContext.Originator && skillUseContext.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)
                {
                    flag2 = false;
                }
                if (!flag2 && particleLOD > 1)
                {
                    GameSettings.ParticleLOD = 1;
                }
                MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2;
            }
            this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, vector, quaternion, out flag);

            if (GameSettings.DynamicParticleLOD)
            {
                MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
            }
            if (this.particleObject == null)
            {
                if (GameSettings.DynamicParticleLOD)
                {
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2;
                }
                this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, vector, quaternion, out flag);

                if (GameSettings.DynamicParticleLOD)
                {
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
                }
                if (this.particleObject == null)
                {
                    if (GameSettings.DynamicParticleLOD)
                    {
                        GameSettings.ParticleLOD = particleLOD;
                    }
                    return;
                }
            }
            if (GameSettings.DynamicParticleLOD)
            {
                GameSettings.ParticleLOD = particleLOD;
            }
            if (!this.particleObject)
            {
                return;
            }
            if (this.particleScaleGrow > 0 && skillUseContext != null && skillUseContext.Originator)
            {
                SkillSlot skillSlot;
                skillUseContext.Originator.handle.SkillControl.TryGetSkillSlot(skillUseContext.SlotType, out skillSlot);
                if (skillSlot != null)
                {
                    int       num            = skillSlot.GetSkillLevel();
                    BaseSkill refParamObject = _action.refParams.GetRefParamObject <BaseSkill>("SkillObj");
                    if (refParamObject != null)
                    {
                        BuffSkill buffSkill = refParamObject.isBuff ? ((BuffSkill)refParamObject) : null;
                        if (buffSkill != null)
                        {
                            byte b = buffSkill.cfgData.bGrowthType;
                            b %= 10;
                            if (b > 0 && (SkillSlotType)b != skillUseContext.SlotType + 1)
                            {
                                SSkillFuncContext sSkillFuncContext = default(SSkillFuncContext);
                                sSkillFuncContext.inOriginator = skillUseContext.Originator;
                                sSkillFuncContext.inBuffSkill  = new PoolObjHandle <BuffSkill>(buffSkill);
                                sSkillFuncContext.inTargetObj  = skillUseContext.TargetActor;
                                sSkillFuncContext.inUseContext = skillUseContext;
                                num = sSkillFuncContext.iSkillLevel;
                            }
                        }
                    }
                    this.particleSystem     = this.particleObject.GetComponentsInChildren <ParticleSystem>(true);
                    this.particleSystemSize = new float[this.particleSystem.Length];
                    for (int i = 0; i < this.particleSystem.Length; i++)
                    {
                        this.particleSystemSize[i] = this.particleSystem[i].startSize;
                    }
                    for (int j = 0; j < this.particleSystem.Length; j++)
                    {
                        this.particleSystem[j].startSize = this.particleSystemSize[j] * ((float)((num - 1) * this.particleScaleGrow) / 10000f + 1f);
                    }
                    this.particleMeshRender      = this.particleObject.GetComponentsInChildren <MeshRenderer>(true);
                    this.particleMeshRenderScale = new Vector3[this.particleMeshRender.Length];
                    for (int k = 0; k < this.particleMeshRender.Length; k++)
                    {
                        this.particleMeshRenderScale[k] = this.particleMeshRender[k].transform.localScale;
                    }
                    for (int l = 0; l < this.particleMeshRender.Length; l++)
                    {
                        this.particleMeshRender[l].transform.localScale = this.particleMeshRenderScale[l] * ((float)((num - 1) * this.particleScaleGrow) / 10000f + 1f);
                    }
                }
            }
            ParticleHelper.IncParticleActiveNumber();
            if (transform != null)
            {
                PoolObjHandle <ActorRoot> ptr = (transform.gameObject == gameObject) ? _action.GetActorHandle(this.targetId) : ActorHelper.GetActorRoot(transform.gameObject);
                if (ptr && ptr.handle.ActorMesh)
                {
                    this.particleObject.transform.parent = ptr.handle.ActorMesh.transform;
                }
                else
                {
                    this.particleObject.transform.parent = transform.parent;
                    if (ptr && FogOfWar.enable && (Singleton <WatchController> .instance.IsWatching || !Singleton <WatchController> .instance.CoversCamp(ptr.handle.TheActorMeta.ActorCamp)))
                    {
                        if (ptr.handle.HorizonMarker != null)
                        {
                            ptr.handle.HorizonMarker.AddSubParObj(this.particleObject);
                        }
                        else
                        {
                            BulletWrapper bulletWrapper = ptr.handle.ActorControl as BulletWrapper;
                            if (bulletWrapper != null)
                            {
                                bulletWrapper.AddSubParObj(this.particleObject);
                            }
                        }
                    }
                }
            }
            string layerName = "Particles";

            if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide"))
            {
                layerName = "Hide";
            }
            if (transform == null && transform2 != null && FogOfWar.enable)
            {
                PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(transform2.gameObject);
                if (actorRoot)
                {
                    if (transform2.gameObject.layer == LayerMask.NameToLayer("Hide"))
                    {
                        layerName = "Hide";
                    }
                    PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.VirtualAttachBulletId);
                    Singleton <GameFowManager> .instance.m_collector.AddVirtualParentParticle(this.particleObject, actorHandle3);
                }
            }
            this.particleObject.SetLayer(layerName, false);
            if (flag)
            {
                ParticleHelper.Init(this.particleObject, this.scaling);
            }
            Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(this.particleObject, Mathf.Max(_action.length, (int)(this.lifeTime * 1000f)), new CGameObjectPool.OnDelayRecycleDelegate(TriggerParticleTick.OnRecycleTickObj), this.particleSystemSize, this.particleMeshRenderScale);

            if (this.applyActionSpeedToParticle && this.particleObject != null)
            {
                _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject);
            }
        }