// Token: 0x06000FDF RID: 4063 RVA: 0x0005706C File Offset: 0x0005526C public static VInt3 Transform(ref VInt3 point, ref VInt3 forward, ref VInt3 trans) { VInt3 up = VInt3.up; VInt3 vint = VInt3.Cross(VInt3.up, forward); return(IntMath.Transform(ref point, ref vint, ref up, ref forward, ref trans)); }
private bool Init(Action _action) { this.srcActor = _action.GetActorHandle(this.sourceId); this.targetActor = _action.GetActorHandle(this.targetId); if ((this.srcActor == 0) || (this.targetActor == 0)) { return(false); } Vector3 pos = (Vector3)IntMath.Transform(this.bindPosOffset, this.srcActor.handle.forward, (VInt3)this.srcActor.handle.gameObject.transform.position); Quaternion rot = Quaternion.LookRotation((Vector3)this.targetActor.handle.forward); bool isInit = false; this.beamObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, pos, rot, out isInit); if (this.beamObject == null) { return(false); } this.lineRenderer = this.beamObject.gameObject.GetComponentInChildren <LineRenderer>(); if (this.lineRenderer == null) { return(false); } this.lineRenderer.SetWidth(this.beamWidth, this.beamWidth); return(true); }
public static Int3 Transform(Int3 point, Int3 forward, Int3 trans, Int3 scale) { Int3 up = Int3.up; Int3 vInt = Int3.Cross(Int3.up, forward); return(IntMath.Transform(ref point, ref vInt, ref up, ref forward, ref trans, ref scale)); }
public static VInt3 Transform(VInt3 point, VInt3 forward, VInt3 trans, VInt3 scale) { VInt3 up = VInt3.up; VInt3 vInt = VInt3.Cross(VInt3.up, forward); return(IntMath.Transform(ref point, ref vInt, ref up, ref forward, ref trans, ref scale)); }
private void RenderBeam() { Vector3 position = (Vector3)IntMath.Transform(this.bindPosOffset, this.srcActor.handle.forward, (VInt3)this.srcActor.handle.gameObject.transform.position); Vector3 vector2 = (Vector3)IntMath.Transform(this.bindPosOffset, this.targetActor.handle.forward, (VInt3)this.targetActor.handle.gameObject.transform.position); this.lineRenderer.SetVertexCount(2); this.lineRenderer.SetPosition(0, position); this.lineRenderer.SetPosition(1, vector2); }
private void RenderBeam() { Vector3 srcPosition = this.GetSrcPosition(); Vector3 position = (Vector3)IntMath.Transform(this.bindDestOffet, this.targetActor.handle.forward, (VInt3)this.targetActor.handle.gameObject.transform.position); this.lineRenderer.SetVertexCount(2); this.lineRenderer.SetPosition(0, srcPosition); this.lineRenderer.SetPosition(1, position); }
public override void UpdateShape(VInt3 location, VInt3 forward) { this.axis[2] = forward; this.axis[0] = VInt3.Cross(ref this.axis[1], ref this.axis[2]); this.worldPos = IntMath.Transform(ref this.localPos, ref this.axis[0], ref this.axis[1], ref this.axis[2], ref location); this.worldExtends.x = this.size.x >> 1; this.worldExtends.y = this.size.y >> 1; this.worldExtends.z = this.size.z >> 1; this.worldRadius = Mathf.Max(this.worldExtends.x, Mathf.Max(this.worldExtends.y, this.worldExtends.z)); this.dirty = false; }
private Vector3 GetSrcPosition() { Vector3 zero = Vector3.zero; if (this.bindPointName.Length != 0) { GameObject obj2 = null; obj2 = SubObject.FindSubObject(this.srcActor.handle.gameObject, this.bindPointName); if (obj2 != null) { return(obj2.transform.position); } } return((Vector3)IntMath.Transform(this.bindPosOffset, this.srcActor.handle.forward, (VInt3)this.srcActor.handle.gameObject.transform.position)); }
public static void UpdatePosition(ref VInt3 worldPos, ref VInt3 localPos, ref VInt3 location, ref VInt3 forward) { if (localPos.x == 0 && localPos.z == 0) { worldPos.x = localPos.x + location.x; worldPos.y = localPos.y + location.y; worldPos.z = localPos.z + location.z; } else { VInt3 up = VInt3.up; VInt3 vInt = forward; VInt3 vInt2 = VInt3.Cross(ref up, ref vInt); VInt3 vInt3 = location; worldPos = IntMath.Transform(ref localPos, ref vInt2, ref up, ref vInt, ref vInt3); } }
public override void UpdateShape(VInt3 location, VInt3 forward) { if ((this.localPos.x == 0) && (this.localPos.z == 0)) { this.worldPos.x = this.localPos.x + location.x; this.worldPos.y = this.localPos.y + location.y; this.worldPos.z = this.localPos.z + location.z; } else { VInt3 up = VInt3.up; VInt3 rhs = forward; VInt3 num3 = VInt3.Cross(ref up, ref rhs); VInt3 trans = location; this.worldPos = IntMath.Transform(ref this.localPos, ref num3, ref up, ref rhs, ref trans); } this.worldRadius = this.localRadius; base.dirty = false; }
private Vector3 GetSrcPosition() { Vector3 result = Vector3.zero; if (this.bindPointName.get_Length() == 0) { result = (Vector3)IntMath.Transform(this.bindPosOffset, this.srcActor.get_handle().forward, this.srcActor.get_handle().location); } else { GameObject gameObject = SubObject.FindSubObject(this.srcActor.get_handle().gameObject, this.bindPointName); if (gameObject != null) { result = gameObject.transform.position; } else { result = (Vector3)IntMath.Transform(this.bindPosOffset, this.srcActor.get_handle().forward, this.srcActor.get_handle().location); } } return(result); }
public override void Process(Action _action, Track _track) { if (MonoSingleton <Reconnection> .GetInstance().isProcessingRelayRecover) { return; } SkillUseContext skillUseContext = null; Vector3 vector = this.bindPosOffset; Quaternion quaternion = this.bindRotOffset; GameObject gameObject = _action.GetGameObject(this.targetId); GameObject gameObject2 = _action.GetGameObject(this.objectSpaceId); Transform transform = null; Transform transform2 = null; if (this.bindPointName.get_Length() == 0) { if (gameObject != null) { transform = gameObject.transform; } else if (gameObject2 != null) { transform2 = gameObject2.transform; } } else { Transform transform3 = null; if (gameObject != null) { GameObject gameObject3 = SubObject.FindSubObject(gameObject, this.bindPointName); if (gameObject3 != null) { transform3 = gameObject3.transform; } if (transform3 != null) { transform = transform3; } else if (gameObject != null) { transform = gameObject.transform; } } else if (gameObject2 != null) { GameObject gameObject4 = SubObject.FindSubObject(gameObject2, this.bindPointName); if (gameObject4 != null) { transform3 = gameObject4.transform; } if (transform3 != null) { transform2 = transform3; } else if (gameObject != null) { transform2 = gameObject2.transform; } } } if (this.bBulletPos) { VInt3 zero = VInt3.zero; _action.refParams.GetRefParam("_BulletPos", ref zero); vector = (Vector3)zero; quaternion = Quaternion.identity; if (this.bBulletDir) { VInt3 zero2 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero2)) { quaternion = Quaternion.LookRotation((Vector3)zero2); } } } else if (transform != null) { vector = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform.rotation * this.bindRotOffset; } else if (transform2 != null) { if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.objectSpaceId); if (actorHandle) { vector = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, actorHandle.handle.forward, actorHandle.handle.location); quaternion = Quaternion.LookRotation((Vector3)actorHandle.handle.forward) * this.bindRotOffset; } } else { vector = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform2.rotation * this.bindRotOffset; } if (this.bBulletDir) { VInt3 zero3 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero3)) { quaternion = Quaternion.LookRotation((Vector3)zero3); quaternion *= this.bindRotOffset; } } else if (this.bBullerPosDir) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (skillUseContext != null) { PoolObjHandle <ActorRoot> originator = skillUseContext.Originator; if (originator) { Vector3 a = transform2.position; if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.objectSpaceId); if (actorHandle2) { a = (Vector3)actorHandle2.handle.location; } } Vector3 forward = a - (Vector3)originator.handle.location; quaternion = Quaternion.LookRotation(forward); quaternion *= this.bindRotOffset; } } } } if (this.bUseIndicatorDir) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (skillUseContext != null) { PoolObjHandle <ActorRoot> originator2 = skillUseContext.Originator; VInt3 ob; if (originator2 && skillUseContext.CalcAttackerDir(out ob, originator2)) { quaternion = Quaternion.LookRotation((Vector3)ob); quaternion *= this.bindRotOffset; } } } if (this.bEnableOptCull && transform2 && transform2.gameObject.layer == LayerMask.NameToLayer("Hide") && !FogOfWar.enable) { return; } if (this.bEnableOptCull && MonoSingleton <GlobalConfig> .instance.bEnableParticleCullOptimize && !MonoSingleton <CameraSystem> .instance.CheckVisiblity(new Bounds(vector, new Vector3((float)this.extend, (float)this.extend, (float)this.extend)))) { return; } bool flag = false; string prefabName; if (this.bUseSkin) { prefabName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance); } else { prefabName = this.resourceName; } if (skillUseContext == null) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); } bool flag2 = true; int particleLOD = GameSettings.ParticleLOD; if (GameSettings.DynamicParticleLOD) { if (skillUseContext != null && skillUseContext.Originator && skillUseContext.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId) { flag2 = false; } if (!flag2 && particleLOD > 1) { GameSettings.ParticleLOD = 1; } MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } return; } } if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } if (!this.particleObject) { return; } if (this.particleScaleGrow > 0 && skillUseContext != null && skillUseContext.Originator) { SkillSlot skillSlot; skillUseContext.Originator.handle.SkillControl.TryGetSkillSlot(skillUseContext.SlotType, out skillSlot); if (skillSlot != null) { int num = skillSlot.GetSkillLevel(); BaseSkill refParamObject = _action.refParams.GetRefParamObject <BaseSkill>("SkillObj"); if (refParamObject != null) { BuffSkill buffSkill = refParamObject.isBuff ? ((BuffSkill)refParamObject) : null; if (buffSkill != null) { byte b = buffSkill.cfgData.bGrowthType; b %= 10; if (b > 0 && (SkillSlotType)b != skillUseContext.SlotType + 1) { SSkillFuncContext sSkillFuncContext = default(SSkillFuncContext); sSkillFuncContext.inOriginator = skillUseContext.Originator; sSkillFuncContext.inBuffSkill = new PoolObjHandle <BuffSkill>(buffSkill); sSkillFuncContext.inTargetObj = skillUseContext.TargetActor; sSkillFuncContext.inUseContext = skillUseContext; num = sSkillFuncContext.iSkillLevel; } } } this.particleSystem = this.particleObject.GetComponentsInChildren <ParticleSystem>(true); this.particleSystemSize = new float[this.particleSystem.Length]; for (int i = 0; i < this.particleSystem.Length; i++) { this.particleSystemSize[i] = this.particleSystem[i].startSize; } for (int j = 0; j < this.particleSystem.Length; j++) { this.particleSystem[j].startSize = this.particleSystemSize[j] * ((float)((num - 1) * this.particleScaleGrow) / 10000f + 1f); } this.particleMeshRender = this.particleObject.GetComponentsInChildren <MeshRenderer>(true); this.particleMeshRenderScale = new Vector3[this.particleMeshRender.Length]; for (int k = 0; k < this.particleMeshRender.Length; k++) { this.particleMeshRenderScale[k] = this.particleMeshRender[k].transform.localScale; } for (int l = 0; l < this.particleMeshRender.Length; l++) { this.particleMeshRender[l].transform.localScale = this.particleMeshRenderScale[l] * ((float)((num - 1) * this.particleScaleGrow) / 10000f + 1f); } } } ParticleHelper.IncParticleActiveNumber(); if (transform != null) { PoolObjHandle <ActorRoot> ptr = (transform.gameObject == gameObject) ? _action.GetActorHandle(this.targetId) : ActorHelper.GetActorRoot(transform.gameObject); if (ptr && ptr.handle.ActorMesh) { this.particleObject.transform.parent = ptr.handle.ActorMesh.transform; } else { this.particleObject.transform.parent = transform.parent; if (ptr && FogOfWar.enable && (Singleton <WatchController> .instance.IsWatching || !Singleton <WatchController> .instance.CoversCamp(ptr.handle.TheActorMeta.ActorCamp))) { if (ptr.handle.HorizonMarker != null) { ptr.handle.HorizonMarker.AddSubParObj(this.particleObject); } else { BulletWrapper bulletWrapper = ptr.handle.ActorControl as BulletWrapper; if (bulletWrapper != null) { bulletWrapper.AddSubParObj(this.particleObject); } } } } } string layerName = "Particles"; if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide")) { layerName = "Hide"; } if (transform == null && transform2 != null && FogOfWar.enable) { PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(transform2.gameObject); if (actorRoot) { if (transform2.gameObject.layer == LayerMask.NameToLayer("Hide")) { layerName = "Hide"; } PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.VirtualAttachBulletId); Singleton <GameFowManager> .instance.m_collector.AddVirtualParentParticle(this.particleObject, actorHandle3); } } this.particleObject.SetLayer(layerName, false); if (flag) { ParticleHelper.Init(this.particleObject, this.scaling); } Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(this.particleObject, Mathf.Max(_action.length, (int)(this.lifeTime * 1000f)), new CGameObjectPool.OnDelayRecycleDelegate(TriggerParticleTick.OnRecycleTickObj), this.particleSystemSize, this.particleMeshRenderScale); if (this.applyActionSpeedToParticle && this.particleObject != null) { _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject); } }
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); } } }
public override void Enter(Action _action, Track _track) { SkillUseContext skillUseContext = null; Vector3 vector = this.bindPosOffset; Quaternion quaternion = this.bindRotOffset; GameObject gameObject = _action.GetGameObject(this.targetId); GameObject gameObject2 = _action.GetGameObject(this.objectSpaceId); Transform transform = null; Transform transform2 = null; if (this.bindPointName.get_Length() == 0) { if (gameObject != null) { transform = gameObject.transform; PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId); this.followTransform = transform; } else if (gameObject2 != null) { transform2 = gameObject2.transform; } } else if (gameObject != null) { GameObject gameObject3 = SubObject.FindSubObject(gameObject, this.bindPointName); if (gameObject3 != null) { transform = gameObject3.transform; } else if (gameObject != null) { transform = gameObject.transform; } } else if (gameObject2 != null) { GameObject gameObject4 = SubObject.FindSubObject(gameObject2, this.bindPointName); if (gameObject4 != null) { transform2 = gameObject4.transform; } else if (gameObject != null) { transform2 = gameObject2.transform; } } if (this.bEnableOptCull && transform2 && transform2.gameObject.layer == LayerMask.NameToLayer("Hide") && !FogOfWar.enable) { return; } if (this.bBulletPos) { VInt3 zero = VInt3.zero; _action.refParams.GetRefParam("_BulletPos", ref zero); vector = (Vector3)zero; quaternion = Quaternion.identity; if (this.bBulletDir) { VInt3 zero2 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero2)) { quaternion = Quaternion.LookRotation((Vector3)zero2); } } } else if (transform != null) { vector = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform.rotation * this.bindRotOffset; } else if (transform2 != null) { if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.objectSpaceId); if (actorHandle2) { vector = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, actorHandle2.handle.forward, actorHandle2.handle.location); quaternion = Quaternion.LookRotation((Vector3)actorHandle2.handle.forward) * this.bindRotOffset; } } else { vector = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform2.rotation * this.bindRotOffset; } if (this.bBulletDir) { VInt3 zero3 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero3)) { quaternion = Quaternion.LookRotation((Vector3)zero3); quaternion *= this.bindRotOffset; } } else if (this.bBullerPosDir) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (skillUseContext != null) { PoolObjHandle <ActorRoot> originator = skillUseContext.Originator; if (originator) { Vector3 a = transform2.position; if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.objectSpaceId); if (actorHandle3) { a = (Vector3)actorHandle3.handle.location; } } Vector3 forward = a - (Vector3)originator.handle.location; quaternion = Quaternion.LookRotation(forward); quaternion *= this.bindRotOffset; } } } } bool flag = false; string prefabName; if (this.bUseSkin) { prefabName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance); } else { prefabName = this.resourceName; } if (skillUseContext == null) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); } bool flag2 = true; int particleLOD = GameSettings.ParticleLOD; if (GameSettings.DynamicParticleLOD) { if (skillUseContext != null && skillUseContext.Originator && skillUseContext.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId) { flag2 = false; } if (!flag2 && particleLOD > 1) { GameSettings.ParticleLOD = 1; } MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (this.particleObject != null) { this.particleTransform = this.particleObject.transform; } if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } return; } this.particleTransform = this.particleObject.transform; } if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } if (this.particleScaleGrow > 0 && skillUseContext != null && skillUseContext.Originator) { SkillSlot skillSlot; skillUseContext.Originator.handle.SkillControl.TryGetSkillSlot(skillUseContext.SlotType, out skillSlot); if (skillSlot != null) { int num = skillSlot.GetSkillLevel(); BaseSkill refParamObject = _action.refParams.GetRefParamObject <BaseSkill>("SkillObj"); if (refParamObject != null) { BuffSkill buffSkill = refParamObject.isBuff ? ((BuffSkill)refParamObject) : null; if (buffSkill != null) { byte b = buffSkill.cfgData.bGrowthType; b %= 10; if (b > 0 && (SkillSlotType)b != skillUseContext.SlotType + 1) { SSkillFuncContext sSkillFuncContext = default(SSkillFuncContext); sSkillFuncContext.inOriginator = skillUseContext.Originator; sSkillFuncContext.inBuffSkill = new PoolObjHandle <BuffSkill>(buffSkill); sSkillFuncContext.inTargetObj = skillUseContext.TargetActor; sSkillFuncContext.inUseContext = skillUseContext; num = sSkillFuncContext.iSkillLevel; } } } this.particleSystem = this.particleObject.GetComponentsInChildren <ParticleSystem>(true); this.particleSystemSize = new float[this.particleSystem.Length]; for (int i = 0; i < this.particleSystem.Length; i++) { this.particleSystemSize[i] = this.particleSystem[i].startSize; } for (int j = 0; j < this.particleSystem.Length; j++) { this.particleSystem[j].startSize = this.particleSystemSize[j] * ((float)((num - 1) * this.particleScaleGrow) / 10000f + 1f); } this.particleMeshRender = this.particleObject.GetComponentsInChildren <MeshRenderer>(true); this.particleMeshRenderScale = new Vector3[this.particleMeshRender.Length]; for (int k = 0; k < this.particleMeshRender.Length; k++) { this.particleMeshRenderScale[k] = this.particleMeshRender[k].transform.localScale; } for (int l = 0; l < this.particleMeshRender.Length; l++) { this.particleMeshRender[l].transform.localScale = this.particleMeshRenderScale[l] * ((float)((num - 1) * this.particleScaleGrow) / 10000f + 1f); } } } ParticleHelper.IncParticleActiveNumber(); if (transform != null) { if (!this.bOnlyFollowPos) { PoolObjHandle <ActorRoot> arg_80D_0 = (transform.gameObject == gameObject) ? _action.GetActorHandle(this.targetId) : ActorHelper.GetActorRoot(transform.gameObject); this.particleTransform.parent = transform; } else { this.offsetPosition = vector - transform.position; } } if (flag) { if (this.enableLayer || this.enableTag) { Transform[] componentsInChildren = this.particleObject.GetComponentsInChildren <Transform>(); for (int m = 0; m < componentsInChildren.Length; m++) { if (this.enableLayer) { componentsInChildren[m].gameObject.layer = this.layer; } if (this.enableTag) { componentsInChildren[m].gameObject.tag = this.tag; } } } ParticleSystem[] componentsInChildren2 = this.particleObject.GetComponentsInChildren <ParticleSystem>(); if (componentsInChildren2 != null) { for (int n = 0; n < componentsInChildren2.Length; n++) { componentsInChildren2[n].startSize *= this.scaling.x; componentsInChildren2[n].startLifetime *= this.scaling.y; componentsInChildren2[n].startSpeed *= this.scaling.z; componentsInChildren2[n].transform.localScale *= this.scaling.x; } ParticleSystemPoolComponent cachedComponent = Singleton <CGameObjectPool> .GetInstance().GetCachedComponent <ParticleSystemPoolComponent>(this.particleObject, true); ParticleSystemPoolComponent.ParticleSystemCache[] array = new ParticleSystemPoolComponent.ParticleSystemCache[componentsInChildren2.Length]; for (int num2 = 0; num2 < array.Length; num2++) { array[num2].par = componentsInChildren2[num2]; array[num2].emmitState = componentsInChildren2[num2].enableEmission; } cachedComponent.cache = array; } } else { ParticleSystemPoolComponent cachedComponent2 = Singleton <CGameObjectPool> .GetInstance().GetCachedComponent <ParticleSystemPoolComponent>(this.particleObject, false); if (null != cachedComponent2) { ParticleSystemPoolComponent.ParticleSystemCache[] cache = cachedComponent2.cache; if (cache != null) { for (int num3 = 0; num3 < cache.Length; num3++) { if (cache[num3].par.enableEmission != cache[num3].emmitState) { cache[num3].par.enableEmission = cache[num3].emmitState; } } } } } string layerName = "Particles"; if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide")) { layerName = "Hide"; } if (transform == null && transform2 != null && FogOfWar.enable) { PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(transform2.gameObject); if (actorRoot) { if (transform2.gameObject.layer == LayerMask.NameToLayer("Hide")) { layerName = "Hide"; } PoolObjHandle <ActorRoot> actorHandle4 = _action.GetActorHandle(this.VirtualAttachBulletId); Singleton <GameFowManager> .instance.m_collector.AddVirtualParentParticle(this.particleObject, actorHandle4); } } this.particleObject.SetLayer(layerName, false); if (this.applyActionSpeedToParticle) { _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject); } }
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; } } } }
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); } }
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; } } }
private void EnterSpawnEye(AGE.Action _action, Track _track) { string prefabName; if (this.bUseSkin) { prefabName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance); } else { prefabName = this.prefabName; } VInt3 zero = VInt3.zero; VInt3 forward = VInt3.forward; SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); COM_PLAYERCAMP com_playercamp = ((refParamObject == null) || (refParamObject.Originator == 0)) ? COM_PLAYERCAMP.COM_PLAYERCAMP_MID : refParamObject.Originator.handle.TheActorMeta.ActorCamp; GameObject gameObject = _action.GetGameObject(this.parentId); PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.parentId); PoolObjHandle <ActorRoot> handle2 = _action.GetActorHandle(this.objectSpaceId); if (handle2 != 0) { ActorRoot handle = handle2.handle; if (this.superTranslation) { VInt3 num3 = VInt3.zero; _action.refParams.GetRefParam("_BulletPos", ref num3); zero = IntMath.Transform(num3, handle.forward, handle.location); } else if (this.modifyTranslation) { zero = IntMath.Transform(this.translation, handle.forward, handle.location); } if (this.modifyDirection) { forward = handle2.handle.forward; } } else if (this.bTargetPosition) { zero = this.translation + this.targetPosition; if ((this.modifyDirection && (refParamObject != null)) && (refParamObject.Originator != 0)) { forward = refParamObject.Originator.handle.forward; } } else { if (this.modifyTranslation) { zero = this.translation; } if ((this.modifyDirection && (this.direction.x != 0)) && (this.direction.y != 0)) { forward = this.direction; forward.NormalizeTo(0x3e8); } } if (this.targetId >= 0) { _action.ExpandGameObject(this.targetId); GameObject obj3 = _action.GetGameObject(this.targetId); if (this.recreateExisting && (obj3 != null)) { if (this.applyActionSpeedToAnimation) { _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Anim, obj3); } if (this.applyActionSpeedToParticle) { _action.RemoveTempObject(AGE.Action.PlaySpeedAffectedType.ePSAT_Fx, obj3); } ActorHelper.DetachActorRoot(obj3); ActionManager.DestroyGameObject(obj3); _action.SetGameObject(this.targetId, null); } GameObject obj4 = null; if (obj3 == null) { ActorStaticData actorData = new ActorStaticData(); IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .instance.GetActorDataProvider(GameActorDataProviderType.StaticBattleDataProvider); ActorMeta actorMeta = new ActorMeta { ActorType = ActorTypeDef.Actor_Type_EYE, ActorCamp = com_playercamp, ConfigId = this.EyeCfgIdByMonster, EnCId = this.EyeCfgIdByMonster }; actorDataProvider.GetActorStaticData(ref actorMeta, ref actorData); CActorInfo info = null; if (!string.IsNullOrEmpty(actorData.TheResInfo.ResPath)) { CActorInfo actorInfo = CActorInfo.GetActorInfo(actorData.TheResInfo.ResPath, enResourceType.BattleScene); if (actorInfo != null) { info = (CActorInfo)UnityEngine.Object.Instantiate(actorInfo); } } PoolObjHandle <ActorRoot> handle3 = new PoolObjHandle <ActorRoot>(); if (info != null) { if ((refParamObject.Originator != 0) && !PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, zero)) { zero = refParamObject.Originator.handle.location; } handle3 = Singleton <GameObjMgr> .instance.SpawnActorEx(null, ref actorMeta, zero, forward, false, true); if (handle3 != 0) { this.actorRoot = handle3; obj4 = handle3.handle.gameObject; handle3.handle.InitActor(); this.CreateEye(); handle3.handle.PrepareFight(); handle3.handle.StartFight(); } } if (handle3 != 0) { if (obj4 == null) { throw new Exception("Age:SpawnObjectDuration Spawn Exception"); } obj4.transform.localScale = Vector3.one; if (GameSettings.DynamicParticleLOD) { bool flag = true; int particleLOD = GameSettings.ParticleLOD; if (((refParamObject != null) && (refParamObject.Originator != 0)) && (refParamObject.Originator.handle.TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId)) { flag = false; } if (!flag && (particleLOD > 1)) { GameSettings.ParticleLOD = 1; } MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag; } this.actorRoot.handle.location = zero; this.actorRoot.handle.forward = forward; if (this.actorRoot.handle.shape != null) { this.actorRoot.handle.shape.ConditionalUpdateShape(); } if (this.actorRoot.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE) { this.actorRoot.handle.TheActorMeta.ConfigId = this.EyeCfgIdByMonster; } if (refParamObject != null) { refParamObject.EffectPos = this.actorRoot.handle.location; if (this.actorRoot.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_EYE) { DebugHelper.Assert(this.actorRoot.handle.TheActorMeta.ActorCamp == com_playercamp); this.actorRoot.handle.TheActorMeta.ActorCamp = com_playercamp; } } } } } }
public override void Process(Action _action, Track _track) { if (MonoSingleton <Reconnection> .GetInstance().isProcessingRelayRecover) { return; } SkillUseContext skillUseContext = null; Vector3 vector = this.bindPosOffset; Quaternion quaternion = this.bindRotOffset; GameObject gameObject = _action.GetGameObject(this.targetId); GameObject gameObject2 = _action.GetGameObject(this.objectSpaceId); Transform transform = null; Transform transform2 = null; if (this.bindPointName.get_Length() == 0) { if (gameObject != null) { transform = gameObject.transform; } else if (gameObject2 != null) { transform2 = gameObject2.transform; } } else { Transform transform3 = null; if (gameObject != null) { GameObject gameObject3 = SubObject.FindSubObject(gameObject, this.bindPointName); if (gameObject3 != null) { transform3 = gameObject3.transform; } if (transform3 != null) { transform = transform3; } else if (gameObject != null) { transform = gameObject.transform; } } else if (gameObject2 != null) { GameObject gameObject3 = SubObject.FindSubObject(gameObject2, this.bindPointName); if (gameObject3 != null) { transform3 = gameObject3.transform; } if (transform3 != null) { transform2 = transform3; } else if (gameObject != null) { transform2 = gameObject2.transform; } } } if (this.bBulletPos) { VInt3 zero = VInt3.zero; _action.refParams.GetRefParam("_BulletPos", ref zero); vector = (Vector3)zero; quaternion = Quaternion.identity; if (this.bBulletDir) { VInt3 zero2 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero2)) { quaternion = Quaternion.LookRotation((Vector3)zero2); } } } else if (transform != null) { vector = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform.rotation * this.bindRotOffset; } else if (transform2 != null) { if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.objectSpaceId); if (actorHandle) { vector = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, actorHandle.get_handle().forward, actorHandle.get_handle().location); quaternion = Quaternion.LookRotation((Vector3)actorHandle.get_handle().forward) * this.bindRotOffset; } } else { vector = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform2.rotation * this.bindRotOffset; } if (this.bBulletDir) { VInt3 zero3 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero3)) { quaternion = Quaternion.LookRotation((Vector3)zero3); quaternion *= this.bindRotOffset; } } else if (this.bBullerPosDir) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (skillUseContext != null) { PoolObjHandle <ActorRoot> originator = skillUseContext.Originator; if (originator) { Vector3 a = transform2.position; if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.objectSpaceId); if (actorHandle2) { a = (Vector3)actorHandle2.get_handle().location; } } Vector3 forward = a - (Vector3)originator.get_handle().location; quaternion = Quaternion.LookRotation(forward); quaternion *= this.bindRotOffset; } } } } if (this.bEnableOptCull && transform2 && transform2.gameObject.layer == LayerMask.NameToLayer("Hide") && !FogOfWar.enable) { return; } if (this.bEnableOptCull && MonoSingleton <GlobalConfig> .get_instance().bEnableParticleCullOptimize&& !MonoSingleton <CameraSystem> .get_instance().CheckVisiblity(new Bounds(vector, new Vector3((float)this.extend, (float)this.extend, (float)this.extend)))) { return; } bool flag = false; string prefabName; if (this.bUseSkin) { prefabName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance); } else { prefabName = this.resourceName; } if (skillUseContext == null) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); } bool flag2 = true; int particleLOD = GameSettings.ParticleLOD; if (GameSettings.DynamicParticleLOD) { if (skillUseContext != null && skillUseContext.Originator && skillUseContext.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId) { flag2 = false; } if (!flag2 && particleLOD > 1) { GameSettings.ParticleLOD = 1; } MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } return; } } if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } if (!this.particleObject) { return; } ParticleHelper.IncParticleActiveNumber(); if (transform != null) { PoolObjHandle <ActorRoot> poolObjHandle = (!(transform.gameObject == gameObject)) ? ActorHelper.GetActorRoot(transform.gameObject) : _action.GetActorHandle(this.targetId); if (poolObjHandle && poolObjHandle.get_handle().ActorMesh) { this.particleObject.transform.parent = poolObjHandle.get_handle().ActorMesh.transform; } else { this.particleObject.transform.parent = transform.parent; if (poolObjHandle && poolObjHandle.get_handle().TheActorMeta.ActorCamp != Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp&& FogOfWar.enable) { if (poolObjHandle.get_handle().HorizonMarker != null) { poolObjHandle.get_handle().HorizonMarker.AddSubParObj(this.particleObject); } else { BulletWrapper bulletWrapper = poolObjHandle.get_handle().ActorControl as BulletWrapper; if (bulletWrapper != null) { bulletWrapper.AddSubParObj(this.particleObject); } } } } } string text = "Particles"; if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } if (transform == null && transform2 != null && FogOfWar.enable) { PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(transform2.gameObject); if (actorRoot && actorRoot.get_handle().TheActorMeta.ActorCamp != Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp) { if (transform2.gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.VirtualAttachBulletId); Singleton <GameFowManager> .get_instance().m_collector.AddVirtualParentParticle(this.particleObject, actorHandle3, this.bUseAttachBulletShape); } } MMGame_Math.SetLayer(this.particleObject, text, false); if (flag) { ParticleHelper.Init(this.particleObject, this.scaling); } Singleton <CGameObjectPool> .GetInstance().RecycleGameObjectDelay(this.particleObject, Mathf.Max(_action.length, (int)(this.lifeTime * 1000f)), new CGameObjectPool.OnDelayRecycleDelegate(TriggerParticleTick.OnRecycleTickObj)); if (this.applyActionSpeedToParticle && this.particleObject != null) { _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject); } }
public override void Process(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); } } } } }
public override void Enter(Action _action, Track _track) { SkillUseContext skillUseContext = null; Vector3 vector = this.bindPosOffset; Quaternion quaternion = this.bindRotOffset; GameObject gameObject = _action.GetGameObject(this.targetId); GameObject gameObject2 = _action.GetGameObject(this.objectSpaceId); Transform transform = null; Transform transform2 = null; if (this.bindPointName.get_Length() == 0) { if (gameObject != null) { transform = gameObject.transform; PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.targetId); this.followTransform = transform; } else if (gameObject2 != null) { transform2 = gameObject2.transform; } } else if (gameObject != null) { GameObject gameObject3 = SubObject.FindSubObject(gameObject, this.bindPointName); if (gameObject3 != null) { transform = gameObject3.transform; } else if (gameObject != null) { transform = gameObject.transform; } } else if (gameObject2 != null) { GameObject gameObject3 = SubObject.FindSubObject(gameObject2, this.bindPointName); if (gameObject3 != null) { transform2 = gameObject3.transform; } else if (gameObject != null) { transform2 = gameObject2.transform; } } if (this.bEnableOptCull && transform2 && transform2.gameObject.layer == LayerMask.NameToLayer("Hide") && !FogOfWar.enable) { return; } if (this.bBulletPos) { VInt3 zero = VInt3.zero; _action.refParams.GetRefParam("_BulletPos", ref zero); vector = (Vector3)zero; quaternion = Quaternion.identity; if (this.bBulletDir) { VInt3 zero2 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero2)) { quaternion = Quaternion.LookRotation((Vector3)zero2); } } } else if (transform != null) { vector = transform.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform.rotation * this.bindRotOffset; } else if (transform2 != null) { if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle2 = _action.GetActorHandle(this.objectSpaceId); if (actorHandle2) { vector = (Vector3)IntMath.Transform((VInt3)this.bindPosOffset, actorHandle2.get_handle().forward, actorHandle2.get_handle().location); quaternion = Quaternion.LookRotation((Vector3)actorHandle2.get_handle().forward) * this.bindRotOffset; } } else { vector = transform2.localToWorldMatrix.MultiplyPoint(this.bindPosOffset); quaternion = transform2.rotation * this.bindRotOffset; } if (this.bBulletDir) { VInt3 zero3 = VInt3.zero; if (_action.refParams.GetRefParam("_BulletDir", ref zero3)) { quaternion = Quaternion.LookRotation((Vector3)zero3); quaternion *= this.bindRotOffset; } } else if (this.bBullerPosDir) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (skillUseContext != null) { PoolObjHandle <ActorRoot> originator = skillUseContext.Originator; if (originator) { Vector3 a = transform2.position; if (gameObject2 != null) { PoolObjHandle <ActorRoot> actorHandle3 = _action.GetActorHandle(this.objectSpaceId); if (actorHandle3) { a = (Vector3)actorHandle3.get_handle().location; } } Vector3 forward = a - (Vector3)originator.get_handle().location; quaternion = Quaternion.LookRotation(forward); quaternion *= this.bindRotOffset; } } } } bool flag = false; string prefabName; if (this.bUseSkin) { prefabName = SkinResourceHelper.GetResourceName(_action, this.resourceName, this.bUseSkinAdvance); } else { prefabName = this.resourceName; } if (skillUseContext == null) { skillUseContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); } bool flag2 = true; int particleLOD = GameSettings.ParticleLOD; if (GameSettings.DynamicParticleLOD) { if (skillUseContext != null && skillUseContext.Originator && skillUseContext.Originator.get_handle().TheActorMeta.PlayerId == Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer().PlayerId) { flag2 = false; } if (!flag2 && particleLOD > 1) { GameSettings.ParticleLOD = 1; } MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(prefabName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (this.particleObject != null) { this.particleTransform = this.particleObject.transform; } if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = flag2; } this.particleObject = MonoSingleton <SceneMgr> .GetInstance().GetPooledGameObjLOD(this.resourceName, true, SceneObjType.ActionRes, vector, quaternion, out flag); if (GameSettings.DynamicParticleLOD) { MonoSingleton <SceneMgr> .GetInstance().m_dynamicLOD = false; } if (this.particleObject == null) { if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } return; } this.particleTransform = this.particleObject.transform; } if (GameSettings.DynamicParticleLOD) { GameSettings.ParticleLOD = particleLOD; } ParticleHelper.IncParticleActiveNumber(); if (transform != null) { if (!this.bOnlyFollowPos) { PoolObjHandle <ActorRoot> arg_5A7_0 = (!(transform.gameObject == gameObject)) ? ActorHelper.GetActorRoot(transform.gameObject) : _action.GetActorHandle(this.targetId); this.particleTransform.parent = transform; } else { this.offsetPosition = vector - transform.position; } } if (flag) { if (this.enableLayer || this.enableTag) { Transform[] componentsInChildren = this.particleObject.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; } } } ParticleSystem[] componentsInChildren2 = this.particleObject.GetComponentsInChildren <ParticleSystem>(); if (componentsInChildren2 != null) { for (int j = 0; j < componentsInChildren2.Length; j++) { componentsInChildren2[j].startSize *= this.scaling.x; componentsInChildren2[j].startLifetime *= this.scaling.y; componentsInChildren2[j].startSpeed *= this.scaling.z; componentsInChildren2[j].transform.localScale *= this.scaling.x; } ParticleSystemPoolComponent cachedComponent = Singleton <CGameObjectPool> .GetInstance().GetCachedComponent <ParticleSystemPoolComponent>(this.particleObject, true); ParticleSystemPoolComponent.ParticleSystemCache[] array = new ParticleSystemPoolComponent.ParticleSystemCache[componentsInChildren2.Length]; for (int k = 0; k < array.Length; k++) { array[k].par = componentsInChildren2[k]; array[k].emmitState = componentsInChildren2[k].enableEmission; } cachedComponent.cache = array; } } else { ParticleSystemPoolComponent cachedComponent2 = Singleton <CGameObjectPool> .GetInstance().GetCachedComponent <ParticleSystemPoolComponent>(this.particleObject, false); if (null != cachedComponent2) { ParticleSystemPoolComponent.ParticleSystemCache[] cache = cachedComponent2.cache; if (cache != null) { for (int l = 0; l < cache.Length; l++) { if (cache[l].par.enableEmission != cache[l].emmitState) { cache[l].par.enableEmission = cache[l].emmitState; } } } } } string text = "Particles"; if (transform && transform.gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } if (transform == null && transform2 != null && FogOfWar.enable) { PoolObjHandle <ActorRoot> actorRoot = ActorHelper.GetActorRoot(transform2.gameObject); if (actorRoot && actorRoot.get_handle().TheActorMeta.ActorCamp != Singleton <GamePlayerCenter> .get_instance().GetHostPlayer().PlayerCamp) { if (transform2.gameObject.layer == LayerMask.NameToLayer("Hide")) { text = "Hide"; } PoolObjHandle <ActorRoot> actorHandle4 = _action.GetActorHandle(this.VirtualAttachBulletId); Singleton <GameFowManager> .get_instance().m_collector.AddVirtualParentParticle(this.particleObject, actorHandle4, this.bUseAttachBulletShape); } } MMGame_Math.SetLayer(this.particleObject, text, false); if (this.applyActionSpeedToParticle) { _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, this.particleObject); } }