예제 #1
0
        public override void Enter(AGE.Action _action, Track _track)
        {
            SkillUseContext refParamObject = null;
            Vector3         bindPosOffset  = this.bindPosOffset;
            Quaternion      bindRotOffset  = this.bindRotOffset;
            GameObject      gameObject     = _action.GetGameObject(this.targetId);
            GameObject      obj3           = _action.GetGameObject(this.objectSpaceId);
            Transform       transform      = null;
            Transform       transform2     = null;

            if (this.bindPointName.Length == 0)
            {
                if (gameObject != null)
                {
                    transform = gameObject.transform;
                    PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId);
                    this.followTransform = transform;
                }
                else if (obj3 != null)
                {
                    transform2 = obj3.transform;
                }
            }
            else
            {
                GameObject obj4 = null;
                if (gameObject != null)
                {
                    obj4 = SubObject.FindSubObject(gameObject, this.bindPointName);
                    if (obj4 != null)
                    {
                        transform = obj4.transform;
                    }
                    else if (gameObject != null)
                    {
                        transform = gameObject.transform;
                    }
                }
                else if (obj3 != null)
                {
                    obj4 = SubObject.FindSubObject(obj3, this.bindPointName);
                    if (obj4 != null)
                    {
                        transform2 = obj4.transform;
                    }
                    else if (gameObject != null)
                    {
                        transform2 = obj3.transform;
                    }
                }
            }
            if ((!this.bEnableOptCull || (transform2 == null)) || (transform2.gameObject.layer != LayerMask.NameToLayer("Hide")))
            {
                string resourceName;
                if (this.bBulletPos)
                {
                    VInt3 zero = VInt3.zero;
                    _action.refParams.GetRefParam("_BulletPos", ref zero);
                    bindPosOffset = (Vector3)zero;
                    bindRotOffset = Quaternion.identity;
                    if (this.bBulletDir)
                    {
                        VInt3 num2 = VInt3.zero;
                        if (_action.refParams.GetRefParam("_BulletDir", ref num2))
                        {
                            bindRotOffset = Quaternion.LookRotation((Vector3)num2);
                        }
                    }
                }
                else if (transform != null)
                {
                    bindPosOffset = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                    bindRotOffset = transform.rotation * this.bindRotOffset;
                }
                else if (transform2 != null)
                {
                    if (obj3 != null)
                    {
                        PoolObjHandle <ActorRoot> handle2 = _action.GetActorHandle(this.objectSpaceId);
                        if (handle2 != 0)
                        {
                            bindPosOffset = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, handle2.handle.forward, (VInt3)obj3.transform.position);
                            bindRotOffset = Quaternion.LookRotation((Vector3)handle2.handle.forward) * this.bindRotOffset;
                        }
                    }
                    else
                    {
                        bindPosOffset = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                        bindRotOffset = transform2.rotation * this.bindRotOffset;
                    }
                    if (this.bBulletDir)
                    {
                        VInt3 num3 = VInt3.zero;
                        if (_action.refParams.GetRefParam("_BulletDir", ref num3))
                        {
                            bindRotOffset = Quaternion.LookRotation((Vector3)num3) * this.bindRotOffset;
                        }
                    }
                    else if (this.bBullerPosDir)
                    {
                        if (refParamObject == null)
                        {
                            refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
                        }
                        if (refParamObject != null)
                        {
                            PoolObjHandle <ActorRoot> originator = refParamObject.Originator;
                            if ((originator != 0) && (originator.handle.gameObject != null))
                            {
                                Vector3 forward = transform2.position - originator.handle.gameObject.transform.position;
                                bindRotOffset = Quaternion.LookRotation(forward) * this.bindRotOffset;
                            }
                        }
                    }
                }
                bool isInit = false;
                if (this.bUseSkin)
                {
                    resourceName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance);
                }
                else
                {
                    resourceName = this.resourceName;
                }
                if (refParamObject == null)
                {
                    refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
                }
                bool flag2       = true;
                int  particleLOD = GameSettings.ParticleLOD;
                if (GameSettings.DynamicParticleLOD)
                {
                    if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.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(resourceName, true, SceneObjType.ActionRes, bindPosOffset, bindRotOffset, out isInit);

                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, bindPosOffset, bindRotOffset, out isInit);

                    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;
                }
                ParticleHelper.IncParticleActiveNumber();
                if (transform != null)
                {
                    if (!this.bOnlyFollowPos)
                    {
                        PoolObjHandle <ActorRoot> handle4 = (transform.gameObject != gameObject) ? ActorHelper.GetActorRoot(transform.gameObject) : _action.GetActorHandle(this.targetId);
                        this.particleObject.transform.parent = transform;
                    }
                    else
                    {
                        this.offsetPosition = bindPosOffset - transform.position;
                    }
                }
                if (isInit)
                {
                    if (this.enableLayer || this.enableTag)
                    {
                        Transform[] transformArray = this.particleObject.GetComponentsInChildren <Transform>();
                        for (int i = 0; i < transformArray.Length; i++)
                        {
                            if (this.enableLayer)
                            {
                                transformArray[i].gameObject.layer = this.layer;
                            }
                            if (this.enableTag)
                            {
                                transformArray[i].gameObject.tag = this.tag;
                            }
                        }
                    }
                    ParticleSystem[] componentsInChildren = this.particleObject.GetComponentsInChildren <ParticleSystem>();
                    if (componentsInChildren != null)
                    {
                        for (int j = 0; j < componentsInChildren.Length; j++)
                        {
                            ParticleSystem system1 = componentsInChildren[j];
                            system1.startSize *= this.scaling.x;
                            ParticleSystem system2 = componentsInChildren[j];
                            system2.startLifetime *= this.scaling.y;
                            ParticleSystem system3 = componentsInChildren[j];
                            system3.startSpeed *= this.scaling.z;
                            Transform transform1 = componentsInChildren[j].transform;
                            transform1.localScale = (Vector3)(transform1.localScale * this.scaling.x);
                        }
                    }
                }
                string layerName = "Particles";
                if ((transform != null) && (transform.gameObject.layer == LayerMask.NameToLayer("Hide")))
                {
                    layerName = "Hide";
                }
                this.particleObject.SetLayer(layerName, false);
                ParticleSystem component = this.particleObject.GetComponent <ParticleSystem>();
                if (component != null)
                {
                    component.Play(true);
                }
                if (this.applyActionSpeedToParticle)
                {
                    _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject);
                }
            }
        }
예제 #2
0
        private void EnterSpawnBullet(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            camp           = ((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 go     = null;
                bool       isInit = true;
                if (obj3 == null)
                {
                    go = MonoSingleton <SceneMgr> .GetInstance().Spawn("TempObject", SceneObjType.Bullet, zero, forward);

                    if (go == null)
                    {
                        throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                    }
                    go.transform.localScale = Vector3.one;
                    bool flag2       = true;
                    int  particleLOD = GameSettings.ParticleLOD;
                    if (GameSettings.DynamicParticleLOD)
                    {
                        if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.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.m_particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, go.transform.position, go.transform.rotation, out isInit);

                    if (GameSettings.DynamicParticleLOD)
                    {
                        MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
                    }
                    if (this.m_particleObj == null)
                    {
                        if (GameSettings.DynamicParticleLOD)
                        {
                            MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2;
                        }
                        this.m_particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.prefabName, true, SceneObjType.ActionRes, go.transform.position, go.transform.rotation, out isInit);

                        if (GameSettings.DynamicParticleLOD)
                        {
                            MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false;
                        }
                    }
                    if (GameSettings.DynamicParticleLOD)
                    {
                        GameSettings.ParticleLOD = particleLOD;
                    }
                    if (this.m_particleObj != null)
                    {
                        this.m_particleObj.transform.SetParent(go.transform);
                        this.m_particleObj.transform.localPosition = Vector3.zero;
                        this.m_particleObj.transform.localRotation = Quaternion.identity;
                    }
                    this.actorRoot = ActorHelper.AttachActorRoot(go, ActorTypeDef.Actor_Type_Bullet, camp, null);
                    _action.SetGameObject(this.targetId, go);
                    this.actorRoot.handle.location = zero;
                    this.actorRoot.handle.forward  = forward;
                    VCollisionShape.InitActorCollision((ActorRoot)this.actorRoot, this.m_particleObj, _action.actionName);
                    if (this.actorRoot.handle.shape != null)
                    {
                        this.actorRoot.handle.shape.ConditionalUpdateShape();
                    }
                    this.actorRoot.handle.InitActor();
                    if (refParamObject != null)
                    {
                        refParamObject.EffectPos = this.actorRoot.handle.location;
                        if (this.actorRoot.handle.TheActorMeta.ActorType != ActorTypeDef.Actor_Type_EYE)
                        {
                            this.CreateBullet();
                        }
                    }
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, go);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, go);
                    }
                    this.actorRoot.handle.StartFight();
                    if (this.enableLayer || this.enableTag)
                    {
                        if (this.enableLayer)
                        {
                            go.layer = this.layer;
                        }
                        if (this.enableTag)
                        {
                            go.tag = this.tag;
                        }
                        Transform[] componentsInChildren = go.GetComponentsInChildren <Transform>();
                        for (int i = 0; i < componentsInChildren.Length; i++)
                        {
                            if (this.enableLayer)
                            {
                                componentsInChildren[i].gameObject.layer = this.layer;
                            }
                            if (this.enableTag)
                            {
                                componentsInChildren[i].gameObject.tag = this.tag;
                            }
                        }
                    }
                    if (isInit)
                    {
                        ParticleHelper.Init(go, this.scaling);
                    }
                    PoolObjHandle <ActorRoot> newActor = _action.GetActorHandle(this.targetId);
                    this.SetParent(ref actorHandle, ref newActor, this.translation);
                    if (this.modifyScaling)
                    {
                        go.transform.localScale = this.scaling;
                    }
                }
            }
            else
            {
                GameObject obj5;
                if (this.modifyDirection)
                {
                    obj5 = MonoSingleton <SceneMgr> .GetInstance().InstantiateLOD(this.prefabName, true, SceneObjType.ActionRes, (Vector3)zero, Quaternion.LookRotation((Vector3)forward));
                }
                else
                {
                    obj5 = MonoSingleton <SceneMgr> .GetInstance().InstantiateLOD(this.prefabName, true, SceneObjType.ActionRes, (Vector3)zero);
                }
                if (obj5 != null)
                {
                    if (this.applyActionSpeedToAnimation)
                    {
                        _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, obj5);
                    }
                    if (this.applyActionSpeedToParticle)
                    {
                        _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, obj5);
                    }
                    if (this.enableLayer)
                    {
                        obj5.layer = this.layer;
                        Transform[] transformArray2 = obj5.GetComponentsInChildren <Transform>();
                        for (int j = 0; j < transformArray2.Length; j++)
                        {
                            transformArray2[j].gameObject.layer = this.layer;
                        }
                    }
                    if (this.enableTag)
                    {
                        obj5.tag = this.tag;
                        Transform[] transformArray3 = obj5.GetComponentsInChildren <Transform>();
                        for (int k = 0; k < transformArray3.Length; k++)
                        {
                            transformArray3[k].gameObject.tag = this.tag;
                        }
                    }
                    if ((obj5.GetComponent <ParticleSystem>() != null) && this.modifyScaling)
                    {
                        ParticleSystem[] systemArray = obj5.GetComponentsInChildren <ParticleSystem>();
                        for (int m = 0; m < systemArray.Length; m++)
                        {
                            ParticleSystem system1 = systemArray[m];
                            system1.startSize *= this.scaling.x;
                            ParticleSystem system2 = systemArray[m];
                            system2.startLifetime *= this.scaling.y;
                            ParticleSystem system3 = systemArray[m];
                            system3.startSpeed *= this.scaling.z;
                            Transform transform = systemArray[m].transform;
                            transform.localScale = (Vector3)(transform.localScale * this.scaling.x);
                        }
                    }
                    PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(obj5);
                    this.SetParent(ref actorHandle, ref actorRoot, this.translation);
                    if (this.modifyScaling)
                    {
                        obj5.transform.localScale = this.scaling;
                    }
                }
            }
        }
예제 #3
0
 public override void Process(AGE.Action _action, Track _track)
 {
     if (!MonoSingleton<Reconnection>.GetInstance().isProcessingRelayRecover)
     {
         SkillUseContext refParamObject = null;
         Vector3 bindPosOffset = this.bindPosOffset;
         Quaternion bindRotOffset = this.bindRotOffset;
         GameObject gameObject = _action.GetGameObject(this.targetId);
         GameObject obj3 = _action.GetGameObject(this.objectSpaceId);
         Transform transform = null;
         Transform transform2 = null;
         if (this.bindPointName.Length == 0)
         {
             if (gameObject != null)
             {
                 transform = gameObject.transform;
             }
             else if (obj3 != null)
             {
                 transform2 = obj3.transform;
             }
         }
         else
         {
             GameObject obj4 = null;
             Transform transform3 = null;
             if (gameObject != null)
             {
                 obj4 = SubObject.FindSubObject(gameObject, this.bindPointName);
                 if (obj4 != null)
                 {
                     transform3 = obj4.transform;
                 }
                 if (transform3 != null)
                 {
                     transform = transform3;
                 }
                 else if (gameObject != null)
                 {
                     transform = gameObject.transform;
                 }
             }
             else if (obj3 != null)
             {
                 obj4 = SubObject.FindSubObject(obj3, this.bindPointName);
                 if (obj4 != null)
                 {
                     transform3 = obj4.transform;
                 }
                 if (transform3 != null)
                 {
                     transform2 = transform3;
                 }
                 else if (gameObject != null)
                 {
                     transform2 = obj3.transform;
                 }
             }
         }
         if (this.bBulletPos)
         {
             VInt3 zero = VInt3.zero;
             _action.refParams.GetRefParam("_BulletPos", ref zero);
             bindPosOffset = (Vector3) zero;
             bindRotOffset = Quaternion.identity;
             if (this.bBulletDir)
             {
                 VInt3 num2 = VInt3.zero;
                 if (_action.refParams.GetRefParam("_BulletDir", ref num2))
                 {
                     bindRotOffset = Quaternion.LookRotation((Vector3) num2);
                 }
             }
         }
         else if (transform != null)
         {
             bindPosOffset = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
             bindRotOffset = transform.rotation * this.bindRotOffset;
         }
         else if (transform2 != null)
         {
             if (obj3 != null)
             {
                 PoolObjHandle<ActorRoot> actorHandle = _action.GetActorHandle(this.objectSpaceId);
                 if (actorHandle != 0)
                 {
                     bindPosOffset = (Vector3) IntMath.Transform((VInt3) this.bindPosOffset, actorHandle.handle.forward, (VInt3) obj3.transform.position);
                     bindRotOffset = Quaternion.LookRotation((Vector3) actorHandle.handle.forward) * this.bindRotOffset;
                 }
             }
             else
             {
                 bindPosOffset = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset);
                 bindRotOffset = transform2.rotation * this.bindRotOffset;
             }
             if (this.bBulletDir)
             {
                 VInt3 num3 = VInt3.zero;
                 if (_action.refParams.GetRefParam("_BulletDir", ref num3))
                 {
                     bindRotOffset = Quaternion.LookRotation((Vector3) num3) * this.bindRotOffset;
                 }
             }
             else if (this.bBullerPosDir)
             {
                 refParamObject = _action.refParams.GetRefParamObject<SkillUseContext>("SkillContext");
                 if (refParamObject != null)
                 {
                     PoolObjHandle<ActorRoot> originator = refParamObject.Originator;
                     if ((originator != 0) && (originator.handle.gameObject != null))
                     {
                         Vector3 forward = transform2.position - originator.handle.gameObject.transform.position;
                         bindRotOffset = Quaternion.LookRotation(forward) * this.bindRotOffset;
                     }
                 }
             }
         }
         if (((!this.bEnableOptCull || (transform2 == null)) || (transform2.gameObject.layer != LayerMask.NameToLayer("Hide"))) && ((!this.bEnableOptCull || !MonoSingleton<GlobalConfig>.instance.bEnableParticleCullOptimize) || MonoSingleton<CameraSystem>.instance.CheckVisiblity(new Bounds(bindPosOffset, new Vector3((float) this.extend, (float) this.extend, (float) this.extend)))))
         {
             string resourceName;
             bool isInit = false;
             if (this.bUseSkin)
             {
                 resourceName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance);
             }
             else
             {
                 resourceName = this.resourceName;
             }
             if (refParamObject == null)
             {
                 refParamObject = _action.refParams.GetRefParamObject<SkillUseContext>("SkillContext");
             }
             bool flag2 = true;
             int particleLOD = GameSettings.ParticleLOD;
             if (GameSettings.DynamicParticleLOD)
             {
                 if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.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(resourceName, true, SceneObjType.ActionRes, bindPosOffset, bindRotOffset, out isInit);
             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, bindPosOffset, bindRotOffset, out isInit);
                 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 != null)
             {
                 ParticleHelper.IncParticleActiveNumber();
                 if (transform != null)
                 {
                     PoolObjHandle<ActorRoot> handle3 = (transform.gameObject != gameObject) ? ActorHelper.GetActorRoot(transform.gameObject) : _action.GetActorHandle(this.targetId);
                     if ((handle3 != 0) && (handle3.handle.ActorMesh != null))
                     {
                         this.particleObject.transform.parent = handle3.handle.ActorMesh.transform;
                     }
                     else
                     {
                         this.particleObject.transform.parent = transform.parent;
                     }
                 }
                 string layerName = "Particles";
                 if ((transform != null) && (transform.gameObject.layer == LayerMask.NameToLayer("Hide")))
                 {
                     layerName = "Hide";
                 }
                 this.particleObject.SetLayer(layerName, false);
                 if (isInit)
                 {
                     ParticleHelper.Init(this.particleObject, this.scaling);
                 }
                 if (!isInit)
                 {
                 }
                 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(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject);
                 }
             }
         }
     }
 }
예제 #4
0
        private GameObject InstParObj(string prefabName, AGE.Action _action, bool bCheckParLife)
        {
            Vector3    bindPosOffset = base.bindPosOffset;
            Quaternion bindRotOffset = base.bindRotOffset;
            GameObject gameObject    = _action.GetGameObject(base.targetId);
            GameObject obj3          = _action.GetGameObject(base.objectSpaceId);
            Transform  parent        = null;
            Transform  transform     = null;

            if (base.bindPointName.Length == 0)
            {
                if (gameObject != null)
                {
                    parent = gameObject.transform;
                }
                else if (obj3 != null)
                {
                    transform = obj3.transform;
                }
            }
            else
            {
                Transform transform3 = null;
                if (gameObject != null)
                {
                    transform3 = SubObject.FindSubObject(gameObject, base.bindPointName).transform;
                    if (transform3 != null)
                    {
                        parent = transform3;
                    }
                    else if (gameObject != null)
                    {
                        parent = gameObject.transform;
                    }
                }
                else if (obj3 != null)
                {
                    transform3 = SubObject.FindSubObject(obj3, base.bindPointName).transform;
                    if (transform3 != null)
                    {
                        transform = transform3;
                    }
                    else if (gameObject != null)
                    {
                        transform = obj3.transform;
                    }
                }
            }
            if (parent != null)
            {
                bindPosOffset = parent.localToWorldMatrix.MultiplyPoint(base.bindPosOffset);
                bindRotOffset = parent.rotation * base.bindRotOffset;
            }
            else if (transform != null)
            {
                bindPosOffset = transform.localToWorldMatrix.MultiplyPoint(base.bindPosOffset);
                bindRotOffset = transform.rotation * base.bindRotOffset;
            }
            if ((transform != null) && (transform.gameObject.layer == LayerMask.NameToLayer("Hide")))
            {
                return(null);
            }
            bool       isInit = false;
            GameObject item   = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, bindPosOffset, bindRotOffset, out isInit);

            if (item == null)
            {
                return(null);
            }
            if (parent != null)
            {
                PoolObjHandle <ActorRoot> handle = (parent.gameObject != gameObject) ? ActorHelper.GetActorRoot(parent.gameObject) : _action.GetActorHandle(base.targetId);
                if ((handle != 0) && (handle.handle.ActorMesh != null))
                {
                    item.transform.SetParent(handle.handle.ActorMesh.transform);
                }
                else
                {
                    item.transform.SetParent(parent);
                }
            }
            string layerName = "Particles";

            if ((parent != null) && (parent.gameObject.layer == LayerMask.NameToLayer("Hide")))
            {
                layerName = "Hide";
            }
            base.particleObject.SetLayer(layerName, false);
            if (!bCheckParLife)
            {
                this.NonAutoDestructParList.Add(item);
            }
            if (isInit)
            {
                ParticleHelper.Init(base.particleObject, base.scaling);
            }
            if (base.applyActionSpeedToParticle)
            {
                _action.AddTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, item);
            }
            return(item);
        }