Exemplo n.º 1
0
 private void DestroyParObj(AGE.Action _action, GameObject inParObj)
 {
     if (inParObj != null)
     {
         inParObj.transform.SetParent(null);
         ActionManager.DestroyGameObjectFromAction(_action, inParObj);
         if (base.applyActionSpeedToParticle)
         {
             _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, inParObj);
         }
     }
 }
Exemplo n.º 2
0
 public override void Leave(AGE.Action _action, Track _track)
 {
     base.Leave(_action, _track);
     if (!this.bEyeObj)
     {
         if (this.m_particleObj != null)
         {
             this.m_particleObj.transform.parent = null;
             ActionManager.DestroyGameObject(this.m_particleObj);
         }
         GameObject gameObject = _action.GetGameObject(this.targetId);
         if ((this.targetId >= 0) && (gameObject != null))
         {
             if (this.applyActionSpeedToAnimation)
             {
                 _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject);
             }
             if (this.applyActionSpeedToParticle)
             {
                 _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject);
             }
             this.RemoveBullet();
             ActorHelper.DetachActorRoot(gameObject);
             ActionManager.DestroyGameObjectFromAction(_action, gameObject);
         }
     }
     if (this.actorSlot != null)
     {
         PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.parentId);
         if (actorHandle != 0)
         {
             actorHandle.handle.RemoveActorRootSlot(this.actorSlot);
         }
         this.actorSlot = null;
     }
 }
Exemplo n.º 3
0
        public override void Leave(AGE.Action _action, Track _track)
        {
            if (this.particleObject != null)
            {
                if (this.iDelayDisappearTime > 0)
                {
                    MonoSingleton <SceneMgr> .GetInstance().AddToRoot(this.particleObject, SceneObjType.ActionRes);

                    Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(this.particleObject, this.iDelayDisappearTime, new CGameObjectPool.OnDelayRecycleDelegate(TriggerParticle.OnDelayRecycleParticleCallback));
                }
                else
                {
                    this.particleObject.transform.position = new Vector3(10000f, 10000f, 10000f);
                    Singleton <CGameObjectPool> .GetInstance().RecycleGameObject(this.particleObject);
                }
                ParticleHelper.DecParticleActiveNumber();
                if (this.applyActionSpeedToParticle)
                {
                    _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject);
                }
            }
        }
Exemplo n.º 4
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;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
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;
                    }
                }
            }
        }