Пример #1
0
 private void Update()
 {
     if (this.checkParticleLife && base.GetComponent <ParticleSystem>().playOnAwake&& base.GetComponent <ParticleSystem>() != null && (base.GetComponent <ParticleSystem>().isStopped || !base.GetComponent <ParticleSystem>().IsAlive()))
     {
         ActionManager.DestroyGameObject(base.gameObject);
     }
 }
Пример #2
0
        public override void Leave(Action _action, Track _track)
        {
            if (this.particleObj != null)
            {
                this.particleObj.transform.parent = null;
                ActionManager.DestroyGameObject(this.particleObj);
            }
            GameObject gameObject = _action.GetGameObject(this.targetId);

            if ((this.targetId >= 0) && (gameObject != null))
            {
                if (this.applyActionSpeedToAnimation)
                {
                    _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject);
                }
                if (this.applyActionSpeedToParticle)
                {
                    _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject);
                }
                this.RemoveEye();
                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;
        }
Пример #3
0
 public void ReplaceNodeObjectPrefab(GameObject obj)
 {
     this.transObjPrefb = obj;
     for (int i = 0; i < this.transNodeObjs.Count; i++)
     {
         ActionManager.DestroyGameObject(this.transNodeObjs[i]);
     }
     this.transNodeObjs.Clear();
     this.RefreshDataToGfx();
 }
Пример #4
0
 public void RemoveAllCurvl(bool destroy)
 {
     if (this.curvlLst != null)
     {
         using (ListView <CurvlData> .Enumerator enumerator = this.curvlLst.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 CurvlData current = enumerator.get_Current();
                 if (current != null)
                 {
                     current.Remove(destroy);
                     if (!destroy)
                     {
                         this.curvlLst.set_Item(current.GetCurvlID(), null);
                     }
                 }
             }
         }
         if (destroy)
         {
             this.curvlLst.Clear();
         }
     }
     if (destroy)
     {
         GameObject gameObject = GameObject.Find(CurvlHelper.sCurvlHelperObjName);
         if (gameObject)
         {
             List <GameObject> list = new List <GameObject>();
             int childCount         = gameObject.transform.childCount;
             for (int i = 0; i < childCount; i++)
             {
                 Transform child       = gameObject.transform.GetChild(i);
                 int       childCount2 = child.childCount;
                 for (int j = 0; j < childCount2; j++)
                 {
                     Transform child2 = child.GetChild(j);
                     list.Add(child2.gameObject);
                 }
                 list.Add(child.gameObject);
             }
             using (List <GameObject> .Enumerator enumerator2 = list.GetEnumerator())
             {
                 while (enumerator2.MoveNext())
                 {
                     GameObject current2 = enumerator2.get_Current();
                     ActionManager.DestroyGameObject(current2);
                 }
             }
         }
     }
 }
Пример #5
0
 public void ReverseNodes()
 {
     if (this.nodeLst != null && this.nodeLst.Count > 1)
     {
         this.nodeLst.Reverse();
         for (int i = this.transNodeObjs.Count - 1; i >= 0; i--)
         {
             if (!this.transNodeObjs[i].activeInHierarchy)
             {
                 ActionManager.DestroyGameObject(this.transNodeObjs[i]);
                 this.transNodeObjs.RemoveAt(i);
             }
         }
         this.transNodeObjs.Reverse();
     }
 }
Пример #6
0
 private void Update()
 {
     if (this.particleSys == null)
     {
         Object.Destroy(this);
         return;
     }
     for (int i = 0; i < this.particleSys.Length; i++)
     {
         ParticleSystem particleSystem = this.particleSys[i];
         if (particleSystem != null && !particleSystem.isStopped && particleSystem.IsAlive())
         {
             return;
         }
     }
     ActionManager.DestroyGameObject(base.gameObject);
 }
Пример #7
0
 public void RemoveAllCurvl(bool destroy)
 {
     if (this.curvlLst != null)
     {
         foreach (CurvlData data in this.curvlLst)
         {
             if (data != null)
             {
                 data.Remove(destroy);
                 if (!destroy)
                 {
                     this.curvlLst[data.GetCurvlID()] = null;
                 }
             }
         }
         if (destroy)
         {
             this.curvlLst.Clear();
         }
     }
     if (destroy)
     {
         GameObject obj2 = GameObject.Find(sCurvlHelperObjName);
         if (obj2 != null)
         {
             List <GameObject> list = new List <GameObject>();
             int childCount         = obj2.transform.childCount;
             for (int i = 0; i < childCount; i++)
             {
                 Transform child = obj2.transform.GetChild(i);
                 int       num3  = child.childCount;
                 for (int j = 0; j < num3; j++)
                 {
                     Transform transform2 = child.GetChild(j);
                     list.Add(transform2.gameObject);
                 }
                 list.Add(child.gameObject);
             }
             foreach (GameObject obj3 in list)
             {
                 ActionManager.DestroyGameObject(obj3);
             }
         }
     }
 }
Пример #8
0
 public override void Leave(Action _action, Track _track)
 {
     base.Leave(_action, _track);
     if (!this.bEyeObj)
     {
         if (this.m_particleObj)
         {
             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(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject);
             }
             if (this.applyActionSpeedToParticle)
             {
                 _action.RemoveTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject);
             }
             if (this.bInvisibleBullet && this.actorRoot.get_handle().ActorControl != null)
             {
                 BulletWrapper bulletWrapper = this.actorRoot.get_handle().ActorControl as BulletWrapper;
                 if (bulletWrapper != null)
                 {
                     bulletWrapper.UninitForInvisibleBullet();
                 }
             }
             this.RemoveBullet();
             ActorHelper.DetachActorRoot(gameObject);
             ActionManager.DestroyGameObjectFromAction(_action, gameObject);
         }
     }
     if (this.actorSlot != null)
     {
         PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.parentId);
         if (actorHandle)
         {
             actorHandle.get_handle().RemoveActorRootSlot(this.actorSlot);
         }
         this.actorSlot = null;
     }
 }
Пример #9
0
 private void Update()
 {
     if (this.particleSys == null)
     {
         UnityEngine.Object.Destroy(this);
     }
     else
     {
         for (int i = 0; i < this.particleSys.Length; i++)
         {
             ParticleSystem system = this.particleSys[i];
             if (((system != null) && !system.isStopped) && system.IsAlive())
             {
                 return;
             }
         }
         ActionManager.DestroyGameObject(base.gameObject);
     }
 }
Пример #10
0
 public void Remove(bool destroy)
 {
     this.isHide  = true;
     this.isInUse = false;
     if (this.transNodeObjs != null)
     {
         foreach (GameObject current in this.transNodeObjs)
         {
             if (current != null)
             {
                 if (destroy)
                 {
                     ActionManager.DestroyGameObject(current);
                 }
                 else
                 {
                     current.SetActive(false);
                 }
             }
         }
     }
     if (this.curvlRootObj != null)
     {
         if (destroy)
         {
             ActionManager.DestroyGameObject(this.curvlRootObj);
         }
         else
         {
             this.curvlRootObj.SetActive(false);
         }
     }
     if (destroy)
     {
         if (this.transNodeObjs != null)
         {
             this.transNodeObjs.Clear();
             this.transNodeObjs = null;
         }
         if (this.nodeLst != null)
         {
             this.nodeLst.Clear();
             this.nodeLst = null;
         }
         if (this.midpoints != null)
         {
             this.midpoints.Clear();
             this.midpoints = null;
         }
         if (this.curvePoints != null)
         {
             this.curvePoints.Clear();
             this.curvePoints = null;
         }
         if (this.extrapoints != null)
         {
             this.extrapoints.Clear();
             this.extrapoints = null;
         }
     }
 }
Пример #11
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);
            }
        }
Пример #12
0
        private void EnterSpawnBullet(Action _action, Track _track)
        {
            string resourceName;

            if (this.bUseSkin)
            {
                resourceName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance);
            }
            else
            {
                resourceName = this.prefabName;
            }
            VInt3                     vInt           = VInt3.zero;
            VInt3                     forward        = VInt3.forward;
            SkillUseContext           refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
            COM_PLAYERCAMP            camp           = (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);
                }
                bool flag = true;
                if (!(gameObject2 == null))
                {
                    return;
                }
                if (this.bForbidBulletInObstacle && !PathfindingUtility.IsValidTarget(refParamObject.Originator.get_handle(), vInt))
                {
                    bool  flag2 = false;
                    VInt3 vInt2 = PathfindingUtility.FindValidTarget(refParamObject.Originator.get_handle(), vInt, refParamObject.Originator.get_handle().location, 10000, out flag2);
                    if (flag2)
                    {
                        VInt vInt3 = 0;
                        PathfindingUtility.GetGroundY(vInt2, out vInt3);
                        vInt2.y = vInt3.i;
                        vInt    = vInt2;
                    }
                    else
                    {
                        vInt = refParamObject.Originator.get_handle().location;
                    }
                }
                GameObject gameObject3 = MonoSingleton <SceneMgr> .GetInstance().Spawn("TempObject", SceneObjType.Bullet, vInt, forward);

                if (!gameObject3)
                {
                    throw new Exception("Age:SpawnObjectDuration Spawn Exception");
                }
                gameObject3.transform.localScale = Vector3.one;
                bool flag3       = true;
                int  particleLOD = GameSettings.ParticleLOD;
                if (GameSettings.DynamicParticleLOD)
                {
                    if (refParamObject != null && refParamObject.Originator && refParamObject.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)
                    {
                        flag3 = false;
                    }
                    if (!flag3 && particleLOD > 1)
                    {
                        GameSettings.ParticleLOD = 1;
                    }
                    MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag3;
                }
                this.m_particleObj = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(resourceName, true, SceneObjType.ActionRes, gameObject3.transform.position, gameObject3.transform.rotation, out flag);

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

                    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(gameObject3.transform);
                    this.m_particleObj.transform.localPosition = Vector3.zero;
                    this.m_particleObj.transform.localRotation = Quaternion.identity;
                }
                this.actorRoot = ActorHelper.AttachActorRoot(gameObject3, ActorTypeDef.Actor_Type_Bullet, camp, null);
                _action.SetGameObject(this.targetId, gameObject3);
                this.actorRoot.get_handle().location = vInt;
                this.actorRoot.get_handle().forward  = forward;
                VCollisionShape.InitActorCollision(this.actorRoot, this.m_particleObj, _action.actionName);
                if (this.actorRoot.get_handle().shape != null)
                {
                    this.actorRoot.get_handle().shape.ConditionalUpdateShape();
                }
                if (this.bInvisibleBullet && this.actorRoot.get_handle().ActorControl != null)
                {
                    BulletWrapper bulletWrapper = this.actorRoot.get_handle().ActorControl as BulletWrapper;
                    if (bulletWrapper != null)
                    {
                        bulletWrapper.InitForInvisibleBullet();
                    }
                }
                this.actorRoot.get_handle().InitActor();
                if (refParamObject != null)
                {
                    refParamObject.EffectPos = this.actorRoot.get_handle().location;
                    if (this.actorRoot.get_handle().TheActorMeta.ActorType != ActorTypeDef.Actor_Type_EYE)
                    {
                        this.CreateBullet();
                    }
                }
                if (this.applyActionSpeedToAnimation)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject3);
                }
                if (this.applyActionSpeedToParticle)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject3);
                }
                this.actorRoot.get_handle().StartFight();
                if (this.enableLayer || this.enableTag)
                {
                    if (this.enableLayer)
                    {
                        gameObject3.layer = this.layer;
                    }
                    if (this.enableTag)
                    {
                        gameObject3.tag = this.tag;
                    }
                    Transform[] componentsInChildren = gameObject3.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 (flag)
                {
                    ParticleHelper.Init(gameObject3, this.scaling);
                }
                PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.targetId);
                this.SetParent(ref actorHandle, ref actorHandle3, this.translation);
                if (this.modifyScaling)
                {
                    gameObject3.transform.localScale = this.scaling;
                }
            }
            else
            {
                GameObject gameObject4;
                if (this.modifyDirection)
                {
                    gameObject4 = MonoSingleton <SceneMgr> .GetInstance().InstantiateLOD(this.prefabName, true, SceneObjType.ActionRes, (Vector3)vInt, Quaternion.LookRotation((Vector3)forward));
                }
                else
                {
                    gameObject4 = MonoSingleton <SceneMgr> .GetInstance().InstantiateLOD(this.prefabName, true, SceneObjType.ActionRes, (Vector3)vInt);
                }
                if (gameObject4 == null)
                {
                    return;
                }
                if (this.applyActionSpeedToAnimation)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject4);
                }
                if (this.applyActionSpeedToParticle)
                {
                    _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject4);
                }
                if (this.enableLayer)
                {
                    gameObject4.layer = this.layer;
                    Transform[] componentsInChildren2 = gameObject4.GetComponentsInChildren <Transform>();
                    for (int j = 0; j < componentsInChildren2.Length; j++)
                    {
                        componentsInChildren2[j].gameObject.layer = this.layer;
                    }
                }
                if (this.enableTag)
                {
                    gameObject4.tag = this.tag;
                    Transform[] componentsInChildren3 = gameObject4.GetComponentsInChildren <Transform>();
                    for (int k = 0; k < componentsInChildren3.Length; k++)
                    {
                        componentsInChildren3[k].gameObject.tag = this.tag;
                    }
                }
                if (gameObject4.GetComponent <ParticleSystem>() && this.modifyScaling)
                {
                    ParticleSystem[] componentsInChildren4 = gameObject4.GetComponentsInChildren <ParticleSystem>();
                    for (int l = 0; l < componentsInChildren4.Length; l++)
                    {
                        componentsInChildren4[l].startSize            *= this.scaling.x;
                        componentsInChildren4[l].startLifetime        *= this.scaling.y;
                        componentsInChildren4[l].startSpeed           *= this.scaling.z;
                        componentsInChildren4[l].transform.localScale *= this.scaling.x;
                    }
                }
                PoolObjHandle <ActorRoot> poolObjHandle = ActorHelper.GetActorRoot(gameObject4);
                this.SetParent(ref actorHandle, ref poolObjHandle, this.translation);
                if (this.modifyScaling)
                {
                    gameObject4.transform.localScale = this.scaling;
                }
            }
        }
Пример #13
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;
                            }
                        }
                    }
                }
            }
        }
Пример #14
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;
                    }
                }
            }
        }
Пример #15
0
 public void Remove(bool destroy)
 {
     this.isHide  = true;
     this.isInUse = false;
     if (this.transNodeObjs != null)
     {
         using (ListView <GameObject> .Enumerator enumerator = this.transNodeObjs.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 GameObject current = enumerator.get_Current();
                 if (current != null)
                 {
                     if (destroy)
                     {
                         ActionManager.DestroyGameObject(current);
                     }
                     else
                     {
                         current.SetActive(false);
                     }
                 }
             }
         }
     }
     if (this.curvlRootObj != null)
     {
         if (destroy)
         {
             ActionManager.DestroyGameObject(this.curvlRootObj);
         }
         else
         {
             this.curvlRootObj.SetActive(false);
         }
     }
     if (destroy)
     {
         if (this.transNodeObjs != null)
         {
             this.transNodeObjs.Clear();
             this.transNodeObjs = null;
         }
         if (this.nodeLst != null)
         {
             this.nodeLst.Clear();
             this.nodeLst = null;
         }
         if (this.midpoints != null)
         {
             this.midpoints.Clear();
             this.midpoints = null;
         }
         if (this.curvePoints != null)
         {
             this.curvePoints.Clear();
             this.curvePoints = null;
         }
         if (this.extrapoints != null)
         {
             this.extrapoints.Clear();
             this.extrapoints = null;
         }
     }
 }