private void EnterSpawnEye(Action _action, Track _track) { if (this.bUseSkin) { string resourceName = SkinResourceHelper.GetResourceName(_action, this.prefabName, this.bUseSkinAdvance); } else { string text = 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) ? refParamObject.Originator.handle.TheActorMeta.ActorCamp : COM_PLAYERCAMP.COM_PLAYERCAMP_MID; 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.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.handle.forward; } } else if (this.bTargetPosition) { vInt = this.translation + this.targetPosition; if (this.modifyDirection && refParamObject != null && refParamObject.Originator) { forward = refParamObject.Originator.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> .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, enResourceType.BattleScene); if (actorInfo != null) { exists = (CActorInfo)Object.Instantiate(actorInfo); } } PoolObjHandle <ActorRoot> ptr = default(PoolObjHandle <ActorRoot>); if (exists) { if (refParamObject.Originator && !PathfindingUtility.IsValidTarget(refParamObject.Originator.handle, vInt) && !Singleton <GameFowManager> .instance.m_pFieldObj.FindNearestNotBrickFromWorldLocNonFow(ref vInt, refParamObject.Originator.handle)) { vInt = refParamObject.Originator.handle.location; } SkillControlIndicator.CheckGrassAttaching(ref vInt); ptr = Singleton <GameObjMgr> .instance.SpawnActorEx(null, ref actorMeta, vInt, forward, false, true); if (ptr) { this.actorRoot = ptr; gameObject3 = ptr.handle.gameObject; ptr.handle.InitActor(); this.CreateEye(refParamObject); ptr.handle.PrepareFight(); ptr.handle.StartFight(); } } if (!ptr) { 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.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 = vInt; 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; } } SpawnEyeEventParam spawnEyeEventParam = new SpawnEyeEventParam(refParamObject.Originator, vInt); Singleton <GameSkillEventSys> .GetInstance().SendEvent <SpawnEyeEventParam>(GameSkillEventDef.Event_SpawnEye, refParamObject.Originator, ref spawnEyeEventParam, GameSkillEventChannel.Channel_HostCtrlActor); } }
public static int operator *(int i, VFactor f) { return((int)IntMath.Divide((long)(i * f.nom), f.den)); }
public void Enter(Action _action) { this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); this.lastTime = 0; this.lastVelocity = (this.lastLerpVelocity = this.velocity); this.stopCondtion = false; this.moveActor = _action.GetActorHandle(this.targetId); if (!this.moveActor) { return; } this.gravityControler = new AccelerateMotionControler(); this.xControler = new xAxisAccelerateMotionControler(); this.moveActor.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp)); if (this.MoveType == ActorMoveType.Target) { if (this.bFindTargetByRotateBodyBullet) { _action.refParams.GetRefParam("FindEnemyActor", ref this.tarActor); } else { this.tarActor = _action.GetActorHandle(this.destId); } if (!this.tarActor) { return; } this.destPosition = this.tarActor.handle.location; CActorInfo charInfo = this.tarActor.handle.CharInfo; if (charInfo != null) { this.hitHeight = charInfo.iBulletHeight; VInt3 a = this.moveActor.handle.location - this.destPosition; a.y = 0; a = a.NormalizeTo(1000); this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 1000L); } this.destPosition.y = this.destPosition.y + this.hitHeight; } else if (this.MoveType == ActorMoveType.Directional) { VInt3 vInt = VInt3.one; if (this.skillContext == null) { return; } PoolObjHandle <ActorRoot> originator = this.skillContext.Originator; if (!originator) { return; } if (this.bBulletUseDir) { _action.refParams.GetRefParam("_BulletUseDir", ref vInt); } else if (this.bUseIndicatorDir) { SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); VInt3 vInt2; if (refParamObject != null && refParamObject.CalcAttackerDir(out vInt2, originator)) { vInt = vInt2; } else { vInt = originator.handle.forward; } } else { vInt = originator.handle.forward; } this.moveActor.handle.forward = vInt; this.moveActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt); vInt = vInt.RotateY(this.offsetDir.y); if (this.bResetMoveDistance) { int num = 0; _action.refParams.GetRefParam("_BulletRealFlyingTime", ref num); int num2 = num * this.velocity / 1000; this.distance = ((num2 > 0) ? num2 : this.distance); } this.destPosition = this.moveActor.handle.location + vInt.NormalizeTo(this.distance); this.destPosition.y = this.moveActor.handle.location.y; } else if (this.MoveType == ActorMoveType.Position) { if (this.bReachDestStop) { this.destPosition = this.targetPosition; } else { VInt3 lhs = this.targetPosition - this.moveActor.handle.location; lhs.y = 0; lhs = lhs.NormalizeTo(1000); this.destPosition = this.moveActor.handle.location + lhs * (this.length * this.velocity / 1000); VInt vInt3; if (PathfindingUtility.GetGroundY(this.destPosition, out vInt3)) { this.destPosition.y = vInt3.i; } } } else if (this.MoveType == ActorMoveType.RotateBody) { this.originateActor = this.skillContext.Originator; if (!this.originateActor) { DebugHelper.Assert(false, "产生子弹的originateActor不能为空!!!"); return; } this.rotateBodyBulletCount = Mathf.Clamp(this.rotateBodyBulletCount, 1, 360); this.rotateBodyCurDirDegreeAngle = 360 / this.rotateBodyBulletCount * this.skillContext.BulletPos.x; VInt3 vInt4 = this.moveActor.handle.forward.RotateY(-this.rotateBodyCurDirDegreeAngle); this.moveActor.handle.forward = vInt4; this.moveActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt4); } if (this.bAdjustSpeed) { VInt3 vInt5 = this.destPosition - this.moveActor.handle.location; int num3 = this.length - 100; num3 = ((num3 <= 0) ? this.length : num3); this.velocity = (int)IntMath.Divide((long)vInt5.magnitude2D * 1000L, (long)num3); } if (this.gravity < 0) { if (this.velocity == 0) { this.stopCondtion = true; return; } VInt3 vInt6 = this.destPosition - this.moveActor.handle.location; int num4; if (!this.shouldUseAcceleration) { num4 = (int)IntMath.Divide((long)vInt6.magnitude2D * 1000L, (long)this.velocity); } else { long num5 = (long)this.velocity; long num6 = (long)this.acceleration; long num7 = (long)vInt6.magnitude2D; long a2 = num5 * num5 + 2L * num6 * num7; num4 = (int)IntMath.Divide(((long)IntMath.Sqrt(a2) - num5) * 1000L, num6); this.lastVelocity = (this.lastLerpVelocity = this.velocity); } if (num4 == 0) { this.stopCondtion = true; return; } VInt vInt7; if (PathfindingUtility.GetGroundY(this.destPosition, out vInt7)) { this.gravityControler.InitMotionControler(num4, vInt7.i - this.moveActor.handle.location.y, this.gravity); } else { this.gravityControler.InitMotionControler(num4, 0, this.gravity); } } if (this.bMoveOnXAxis) { this.zDirection = this.destPosition - this.moveActor.handle.location; this.xDirection = VInt3.Cross(VInt3.up, this.zDirection); this.zCurPosition = this.moveActor.handle.location; if (this.bReachDestStop) { int[] array = new int[3]; VInt3[] array2 = new VInt3[] { default(VInt3), default(VInt3), this.destPosition - this.moveActor.handle.location }; array2[0] = array2[2]; array2[1] = array2[2]; array2[0].NormalizeTo(this.distanceZ0); array2[1].NormalizeTo(this.distanceZ1); for (int i = 0; i < array.Length; i++) { if (!this.shouldUseAcceleration) { array[i] = (int)IntMath.Divide((long)array2[i].magnitude2D * 1000L, (long)this.velocity); } else { long num8 = (long)this.velocity; long num9 = (long)this.acceleration; long num10 = (long)array2[i].magnitude2D; long a3 = num8 * num8 + 2L * num9 * num10; array[i] = (int)IntMath.Divide(((long)IntMath.Sqrt(a3) - num8) * 1000L, num9); } } if (array[2] > array[1] && array[1] > array[0] && array[0] > 0) { this.xControler.InitMotionControler(array[0], array[1], array[2], this.distanceZ0, this.distanceZ1, this.distanceX); int desPostion = this.xControler.getDesPostion(); this.xDestPosition = this.xDirection; this.xDestPosition.NormalizeTo(Math.Abs(desPostion)); if (desPostion < 0) { this.xDestPosition = -this.xDestPosition; } } else { this.bMoveOnXAxis = false; } } } }
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; } } } }
public static Int3 operator *(Int3 v, VFactor f) { return(IntMath.Divide(v, f.nom, f.den)); }
public override void Enter(AGE.Action _action, Track _track) { this.done_ = false; base.Enter(_action, _track); this.actor_ = _action.GetActorHandle(this.targetId); if (this.actor_ != 0) { if (!this.actor_.handle.isMovable) { this.actor_.Release(); this.done_ = true; } else { this.actor_.handle.ActorControl.TerminateMove(); this.actor_.handle.ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Move); this.lastTime_ = 0; this.movement = this.actor_.handle.MovementComponent as PlayerMovement; this.motionControler = new AccelerateMotionControler(); if (this.movement != null) { int motionControlerCount = this.movement.GravityMode.GetMotionControlerCount(); if (motionControlerCount < 3) { if (motionControlerCount == 0) { this.motionControler.InitMotionControler(base.length, 0, this.gravity); } else if (motionControlerCount == 1) { this.motionControler.InitMotionControler(base.length, 0, IntMath.Divide((int)(this.gravity * 6), 10)); } else if (motionControlerCount == 2) { this.motionControler.InitMotionControler(base.length, 0, IntMath.Divide((int)(this.gravity * 4), 10)); } this.movement.GravityMode.AddMotionControler(this.motionControler); this.movement.isFlying = true; this.bMotionControl = true; } } } } }
public static VInt2 operator *(VInt2 v, VFactor f) { return(IntMath.Divide(v, f.nom, f.den)); }
public static VInt2 Divide(VInt2 a, long b) { a.x = (int)IntMath.Divide((long)a.x, b); a.y = (int)IntMath.Divide((long)a.y, b); return(a); }
public static VInt3 Transform(VInt3 point, ref VInt3 axis_x, ref VInt3 axis_y, ref VInt3 axis_z, ref VInt3 trans) { return(new VInt3(IntMath.Divide(axis_x.x * point.x + axis_y.x * point.y + axis_z.x * point.z, 1000) + trans.x, IntMath.Divide(axis_x.y * point.x + axis_y.y * point.y + axis_z.y * point.z, 1000) + trans.y, IntMath.Divide(axis_x.z * point.x + axis_y.z * point.y + axis_z.z * point.z, 1000) + trans.z)); }
public bool StartPathing(SmartEntity troop, SmartEntity target, TransformComponent transform, bool clampPathLength, out bool found, int rangeOverride, PathTroopParams troopParams, PathBoardParams boardParams, bool isRepathing, bool allowTroopFanning) { if (troop == null || target == null) { found = false; return(true); } if (this.IsPathingOngoing()) { found = false; return(false); } boardParams.IgnoreWall = (boardParams.IgnoreWall || troop.TroopComp.TroopType.IsFlying); this.troop = troop; this.target = target; this.noWall = boardParams.IgnoreWall; this.crushesWalls = troopParams.CrushesWalls; this.transform = transform; SmartEntity smartEntity = (SmartEntity)transform.Entity; int x = transform.X; int z = transform.Z; BoardCell cellAt = this.boardController.Board.GetCellAt(x, z); BoardCell boardCell = null; DamageableComponent damageableComp = target.DamageableComp; ShooterComponent shooterComp = troop.ShooterComp; this.pathingComp = smartEntity.PathingComp; BoardCell boardCell2; if (this.pathingComp != null && isRepathing && this.pathingComp.TargetCell != null && this.pathingComp.EndCell != null && damageableComp != null) { boardCell2 = this.pathingComp.TargetCell; boardCell = this.pathingComp.EndCell; } else if (damageableComp != null) { uint maxRange = (rangeOverride < 0) ? shooterComp.ShooterVO.MaxAttackRange : ((uint)rangeOverride); boardCell = damageableComp.FindAttackCell(maxRange, troopParams.TroopWidth, x, z, allowTroopFanning); int x2; int z2; damageableComp.GetCenterPosition(out x2, out z2); boardCell2 = this.boardController.Board.GetCellAt(x2, z2); } else { TransformComponent transformComp = target.TransformComp; boardCell2 = this.boardController.Board.GetCellAt(transformComp.CenterGridX(), transformComp.CenterGridZ()); int squaredDistanceToTarget = GameUtils.GetSquaredDistanceToTarget(shooterComp, target); bool flag = (long)squaredDistanceToTarget > (long)((ulong)shooterComp.MaxAttackRangeSquared); if (boardCell2 != cellAt && !troopParams.IsHealer) { if (flag) { int x3 = boardCell2.X - cellAt.X; int y = boardCell2.Z - cellAt.Z; int num = IntMath.Atan2Lookup(x3, y) * 180 / 16384; int targetCount = target.TroopComp.TargetCount; int num2 = (int)((troopParams.MaxRange <= 1u) ? 1u : (troopParams.MaxRange - 1u)); int num3 = num2; while (num3 > 0 && boardCell == null) { int num4 = num3 * 3 + 1; int num5 = 180 / num4; for (int i = 0; i < num4; i++) { int num6 = (i + targetCount) % num4; int twiceAngle = (num + 90 + num6 * num5) % 360 * 2; int x4 = boardCell2.X + IntMath.cosLookup(twiceAngle) * num3 / 1024; int z3 = boardCell2.Z + IntMath.sinLookup(twiceAngle) * num3 / 1024; boardCell = this.boardController.Board.GetClampedToBoardCellAt(x4, z3, troopParams.TroopWidth); if ((boardCell.Children == null || boardCell.Children.Count == 0) && boardCell.Clearance >= troopParams.TroopWidth) { break; } boardCell = null; } num3--; } } else { boardCell = cellAt; } } if (boardCell == null) { boardCell = boardCell2; if (boardCell.Clearance < troopParams.TroopWidth) { this.pathingComp = null; found = false; return(false); } } } WalkerComponent walkerComp = smartEntity.WalkerComp; if (this.pathingComp == null) { this.pathingComp = new PathingComponent(walkerComp.SpeedVO.MaxSpeed, target); } else { this.pathingComp.Reset(); this.pathingComp.MaxSpeed = walkerComp.SpeedVO.MaxSpeed; this.pathingComp.Target = target; } this.pathingComp.TargetCell = boardCell2; this.pathingComp.EndCell = boardCell; int maxLength = -1; BattleController battleController = Service.BattleController; if (clampPathLength && (battleController == null || battleController.GetCurrentBattle().Type == BattleType.Pvp || battleController.GetCurrentBattle().Type == BattleType.ClientBattle)) { int num7 = IntMath.FastDist(cellAt.X, cellAt.Z, boardCell2.X, boardCell2.Z); maxLength = 2 * num7 / 1024 + 2; } this.path = new Path(cellAt, boardCell, boardCell2, maxLength, troopParams, boardParams); this.UpdatePathing(out found); return(true); }
public IEnumerable <object> read(bool includeMetadata) { DateTime current = MiscUtils.UNIX_EPOCH_START_DATE; while (App.Active) { while (App.Active) { var h = Format.TryReadPageHeader(m_Stream, ref current); if (h == Format.PageHeaderReadStatus.OK) { break; } if (h == Format.PageHeaderReadStatus.EOF) { yield break; } var pos = Stream.Position; var newPos = IntMath.Align16(pos); var delta = newPos - pos; var eof = true; try { if (delta > 0) { Stream.Seek(delta, SeekOrigin.Current); } eof = false; } catch {} if (eof) { yield break; } }//page while (App.Active) { byte rec = Format.REC_INVALID; try{ rec = Format.ReadByte(m_Stream); } catch {} if (rec == Format.REC_EOF) { break; } else if (rec == Format.REC_TIMESTAMP) { DateTime ts = DateTime.MinValue; try{ ts = Format.ReadTimeStamp(m_Stream); } catch {} if (ts <= MiscUtils.UNIX_EPOCH_START_DATE || ts < current)//corruption { if (includeMetadata) { yield return(LogCorruption.Instance); } break; } current = ts; if (includeMetadata) { yield return(new LogUTCTimeStamp(ts)); } } else if (rec == Format.REC_SERIALIZER) { //todo deserialize } else { if (includeMetadata) { yield return(LogCorruption.Instance); } break; } } //records } //outer }
public override int GetMotionDistance(int _allTime) { long a = ((base.motionSpeed * _allTime) << 1) + (this.accelerateSpeed * (_allTime * _allTime)); return((int)IntMath.Divide(a, 0x7d0L)); }
public override void Enter(AGE.Action _action, Track _track) { this.done_ = false; this.lastTime_ = 0; base.Enter(_action, _track); this.actor_ = _action.GetActorHandle(this.actorId); if ((this.actor_ != 0) && ((this.teleport || (this.moveSpeed != 0)) || (this.acceleration != 0))) { this.srcPos = this.actor_.handle.location; if (this.bUseRecordPosition && (this.actor_.handle.SkillControl != null)) { this.destPos = this.actor_.handle.SkillControl.RecordPosition; this.dir = this.destPos - this.srcPos; VInt3 num8 = this.destPos - this.srcPos; int num2 = num8.magnitude2D; this.moveDistance += num2; } else if (this.moveType == ActorMoveType.Target) { int num3; PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.destId); if ((this.actor_ == 0) || (actorHandle == 0)) { this.actor_.Release(); return; } if (actorHandle.handle.ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveCity)) { num3 = 0; } else { this.dir = actorHandle.handle.location - this.srcPos; VInt3 num9 = actorHandle.handle.location - this.srcPos; num3 = num9.magnitude2D; } this.moveDistance += num3; } else if (this.moveType == ActorMoveType.Position) { this.dir = this.destPos - this.srcPos; VInt3 num10 = this.destPos - this.srcPos; int minMoveDistance = num10.magnitude2D; if (minMoveDistance < this.minMoveDistance) { minMoveDistance = this.minMoveDistance; } this.moveDistance += minMoveDistance; } else if (this.moveType == ActorMoveType.Directional) { this.dir = this.actor_.handle.forward; } this.dir.y = 0; this.actor_.handle.ActorControl.TerminateMove(); if (this.bRecordPosition && (this.actor_.handle.SkillControl != null)) { this.actor_.handle.SkillControl.RecordPosition = this.actor_.handle.location; } if (!this.actor_.handle.isMovable || (this.dir.sqrMagnitudeLong <= 1L)) { this.actor_.Release(); this.done_ = true; } else { VInt3 dir = this.dir; this.finalPos = this.srcPos + dir.NormalizeTo(this.moveDistance); if (!PathfindingUtility.IsValidTarget((ActorRoot)this.actor_, this.finalPos)) { this.IgnoreCollision = false; } if (!this.shouldUseAcceleration) { this.moveTick = (this.moveDistance * 0x3e8) / this.moveSpeed; } else { long moveDistance = this.moveDistance; long acceleration = this.acceleration; long moveSpeed = this.moveSpeed; this.moveTick = (int)IntMath.Divide((long)((IntMath.Sqrt((moveSpeed * moveSpeed) + ((2L * acceleration) * moveDistance)) - moveSpeed) * 0x3e8L), acceleration); this.lastMoveSpeed = this.moveSpeed; this.lastLerpMoveSpeed = this.moveSpeed; } this.actor_.handle.ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Move); this.actor_.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp)); this.fromRot = this.actor_.handle.rotation; this.actor_.handle.MovementComponent.SetRotate(this.dir, true); if (this.rotationTime > 0) { this.toRot = Quaternion.LookRotation((Vector3)this.actor_.handle.forward); } else { this.actor_.handle.rotation = Quaternion.LookRotation((Vector3)this.actor_.handle.forward); } } } }
public void Insert(Agent agent) { int num = 0; IntRect1 r = this.bounds; Int2 xz = agent.position.xz; agent.next = null; this.maxRadius = IntMath.Max((long)agent.radius.i, this.maxRadius); int num2 = 0; while (true) { num2++; if (this.nodes[num].child00 == num) { if (this.nodes[num].count < 15 || num2 > 10) { break; } RVOQuadtree.Node node = this.nodes[num]; node.child00 = this.GetNodeIndex(); node.child01 = this.GetNodeIndex(); node.child10 = this.GetNodeIndex(); node.child11 = this.GetNodeIndex(); this.nodes[num] = node; this.nodes[num].Distribute(this.nodes, r); } if (this.nodes[num].child00 != num) { Int2 center = r.center; if (xz.x > center.x) { if (xz.y > center.y) { num = this.nodes[num].child11; r = IntRect1.MinMaxRect(center.x, center.y, r.xMax, r.yMax); } else { num = this.nodes[num].child10; r = IntRect1.MinMaxRect(center.x, r.yMin, r.xMax, center.y); } } else if (xz.y > center.y) { num = this.nodes[num].child01; r = IntRect1.MinMaxRect(r.xMin, center.y, center.x, r.yMax); } else { num = this.nodes[num].child00; r = IntRect1.MinMaxRect(r.xMin, r.yMin, center.x, center.y); } } } this.nodes[num].Add(agent); RVOQuadtree.Node[] expr_94_cp_0 = this.nodes; int expr_94_cp_1 = num; expr_94_cp_0[expr_94_cp_1].count = (byte)(expr_94_cp_0[expr_94_cp_1].count + 1); }
public override int GetMotionDistance(int _allTime) { long a = ((long)this.motionSpeed * (long)_allTime << 1) + (long)this.curAccelaration * ((long)_allTime * (long)_allTime) / 1000L; return((int)IntMath.Divide(a, 2000L)); }
public static VInt3 Transform(ref VInt3 point, ref VInt3 axis_x, ref VInt3 axis_y, ref VInt3 axis_z, ref VInt3 trans, ref VInt3 scale) { long num = (long)point.x * (long)scale.x; long num2 = (long)point.y * (long)scale.x; long num3 = (long)point.z * (long)scale.x; return(new VInt3((int)IntMath.Divide((long)axis_x.x * num + (long)axis_y.x * num2 + (long)axis_z.x * num3, 1000000L) + trans.x, (int)IntMath.Divide((long)axis_x.y * num + (long)axis_y.y * num2 + (long)axis_z.y * num3, 1000000L) + trans.y, (int)IntMath.Divide((long)axis_x.z * num + (long)axis_y.z * num2 + (long)axis_z.z * num3, 1000000L) + trans.z)); }
public int GetLerpMotionDistance(int _allTime) { long a = ((long)this.lerpMotionSpeed * (long)_allTime << 1) + (long)this.curLerpAccelaration * ((long)_allTime * (long)_allTime) / 1000L; return((int)IntMath.Divide(a, 2000L)); }
public static int Lerp(int src, int dest, int nom, int den) { return(IntMath.Divide(src * den + (dest - src) * nom, den)); }
public bool IsPointIn(ref VInt3 pnt) { return(((this._vertecesXZ != null) && this.IsInBoundXZ(pnt)) && IntMath.PointInPolygon(ref pnt.xz, this._vertecesXZ)); }
public static long Lerp(long src, long dest, long nom, long den) { return(IntMath.Divide(src * den + (dest - src) * nom, den)); }
public static VInt3 operator /(VInt3 v, VFactor f) { return(IntMath.Divide(v, f.den, f.nom)); }
public static bool IntersectSegment(ref VInt2 seg1Src, ref VInt2 seg1Vec, ref VInt2 seg2Src, ref VInt2 seg2Vec, out VInt2 interPoint) { long num; long num2; long num3; IntMath.SegvecToLinegen(ref seg1Src, ref seg1Vec, out num, out num2, out num3); long num4; long num5; long num6; IntMath.SegvecToLinegen(ref seg2Src, ref seg2Vec, out num4, out num5, out num6); long num7 = num * num5 - num4 * num2; if (num7 != 0L) { long num8 = IntMath.Divide(num2 * num6 - num5 * num3, num7); long num9 = IntMath.Divide(num4 * num3 - num * num6, num7); bool result = IntMath.IsPointOnSegment(ref seg1Src, ref seg1Vec, num8, num9) && IntMath.IsPointOnSegment(ref seg2Src, ref seg2Vec, num8, num9); interPoint.x = (int)num8; interPoint.y = (int)num9; return(result); } interPoint = VInt2.zero; return(false); }
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 static bool Linecast(INavmesh graph, VInt3 tmp_origin, VInt3 tmp_end, GraphNode hint, out GraphHitInfo hit, List <GraphNode> trace) { VInt3 vInt = tmp_end; VInt3 vInt2 = tmp_origin; hit = default(GraphHitInfo); if (float.IsNaN((float)(tmp_origin.x + tmp_origin.y + tmp_origin.z))) { throw new ArgumentException("origin is NaN"); } if (float.IsNaN((float)(tmp_end.x + tmp_end.y + tmp_end.z))) { throw new ArgumentException("end is NaN"); } TriangleMeshNode triangleMeshNode = hint as TriangleMeshNode; if (triangleMeshNode == null) { triangleMeshNode = ((graph as NavGraph).GetNearest(tmp_origin, NNConstraint.None).node as TriangleMeshNode); if (triangleMeshNode == null) { Debug.LogError("Could not find a valid node to start from"); hit.point = tmp_origin; return(true); } } if (vInt2 == vInt) { hit.node = triangleMeshNode; return(false); } vInt2 = (VInt3)triangleMeshNode.ClosestPointOnNode((Vector3)vInt2); hit.origin = vInt2; if (!triangleMeshNode.Walkable) { hit.point = vInt2; hit.tangentOrigin = vInt2; return(true); } List <VInt3> list = ListPool <VInt3> .Claim(); List <VInt3> list2 = ListPool <VInt3> .Claim(); int num = 0; while (true) { num++; if (num > 2000) { break; } TriangleMeshNode triangleMeshNode2 = null; if (trace != null) { trace.Add(triangleMeshNode); } if (triangleMeshNode.ContainsPoint(vInt)) { goto Block_9; } for (int i = 0; i < triangleMeshNode.connections.Length; i++) { if (triangleMeshNode.connections[i].GraphIndex == triangleMeshNode.GraphIndex) { list.Clear(); list2.Clear(); if (triangleMeshNode.GetPortal(triangleMeshNode.connections[i], list, list2, false)) { VInt3 vInt3 = list.get_Item(0); VInt3 vInt4 = list2.get_Item(0); float num2; float num3; if ((Polygon.LeftNotColinear(vInt3, vInt4, hit.origin) || !Polygon.LeftNotColinear(vInt3, vInt4, tmp_end)) && Polygon.IntersectionFactor(vInt3, vInt4, hit.origin, tmp_end, out num2, out num3) && num3 >= 0f && num2 >= 0f && num2 <= 1f) { triangleMeshNode2 = (triangleMeshNode.connections[i] as TriangleMeshNode); break; } } } } if (triangleMeshNode2 == null) { goto Block_17; } triangleMeshNode = triangleMeshNode2; } Debug.LogError("Linecast was stuck in infinite loop. Breaking."); ListPool <VInt3> .Release(list); ListPool <VInt3> .Release(list2); return(true); Block_9: ListPool <VInt3> .Release(list); ListPool <VInt3> .Release(list2); return(false); Block_17: int vertexCount = triangleMeshNode.GetVertexCount(); for (int j = 0; j < vertexCount; j++) { VInt3 vertex = triangleMeshNode.GetVertex(j); VInt3 vertex2 = triangleMeshNode.GetVertex((j + 1) % vertexCount); VFactor vFactor; VFactor vFactor2; if ((Polygon.LeftNotColinear(vertex, vertex2, hit.origin) || !Polygon.LeftNotColinear(vertex, vertex2, tmp_end)) && Polygon.IntersectionFactor(vertex, vertex2, hit.origin, tmp_end, out vFactor, out vFactor2) && !vFactor2.IsNegative && !vFactor.IsNegative && vFactor.nom / vFactor.den <= 1L) { VInt3 vInt5 = (vertex2 - vertex) * (float)vFactor.nom; vInt5 = IntMath.Divide(vInt5, vFactor.den); vInt5 += vertex; hit.point = vInt5; hit.node = triangleMeshNode; hit.tangent = vertex2 - vertex; hit.tangentOrigin = vertex; ListPool <VInt3> .Release(list); ListPool <VInt3> .Release(list2); return(true); } } Debug.LogWarning("Linecast failing because point not inside node, and line does not hit any edges of it"); ListPool <VInt3> .Release(list); ListPool <VInt3> .Release(list2); return(false); }
public static Int2 operator /(Int2 v, VFactor f) { return(IntMath.Divide(v, f.den, f.nom)); }
public void Enter(AGE.Action _action) { this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); this.lastTime = 0; this.lastVelocity = this.lastLerpVelocity = this.velocity; this.stopCondtion = false; this.moveActor = _action.GetActorHandle(this.targetId); if (this.moveActor != 0) { this.gravityControler = new AccelerateMotionControler(); this.moveActor.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp)); if (this.MoveType == ActorMoveType.Target) { this.tarActor = _action.GetActorHandle(this.destId); if (this.tarActor == 0) { return; } this.destPosition = this.tarActor.handle.location; CActorInfo charInfo = this.tarActor.handle.CharInfo; if (charInfo != null) { this.hitHeight = charInfo.iBulletHeight; VInt3 a = this.moveActor.handle.location - this.destPosition; a.y = 0; a = a.NormalizeTo(0x3e8); this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 0x3e8L); } this.destPosition.y += this.hitHeight; } else if (this.MoveType == ActorMoveType.Directional) { VInt3 one = VInt3.one; if (this.skillContext == null) { return; } PoolObjHandle <ActorRoot> originator = this.skillContext.Originator; if (originator == 0) { return; } one = originator.handle.forward.RotateY(this.offsetDir.y); this.destPosition = this.moveActor.handle.location + one.NormalizeTo(this.distance); this.destPosition.y = this.moveActor.handle.location.y; } else if (this.MoveType == ActorMoveType.Position) { this.destPosition = this.targetPosition; } if (this.bAdjustSpeed) { VInt3 num3 = this.destPosition - this.moveActor.handle.location; int num4 = this.length - 100; num4 = (num4 > 0) ? num4 : this.length; this.velocity = (int)IntMath.Divide((long)(num3.magnitude2D * 0x3e8L), (long)num4); } if (this.gravity < 0) { if (this.velocity == 0) { this.stopCondtion = true; } else { VInt3 num5 = this.destPosition - this.moveActor.handle.location; int num6 = 0; if (!this.shouldUseAcceleration) { num6 = (int)IntMath.Divide((long)(num5.magnitude2D * 0x3e8L), (long)this.velocity); } else { long velocity = this.velocity; long acceleration = this.acceleration; long num9 = num5.magnitude2D; long num10 = (velocity * velocity) + ((2L * acceleration) * num9); num6 = (int)IntMath.Divide((long)((IntMath.Sqrt(num10) - velocity) * 0x3e8L), acceleration); this.lastVelocity = this.lastLerpVelocity = this.velocity; } if (num6 == 0) { this.stopCondtion = true; } else { VInt num11; if (PathfindingUtility.GetGroundY(this.destPosition, out num11)) { this.gravityControler.InitMotionControler(num6, num11.i - this.moveActor.handle.location.y, this.gravity); } else { this.gravityControler.InitMotionControler(num6, 0, this.gravity); } } } } } }
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 void ProcessInner(AGE.Action _action, Track _track, int delta) { VInt3 location = this.moveActor.handle.location; if ((this.MoveType == ActorMoveType.Target) && (this.tarActor != 0)) { this.destPosition = this.tarActor.handle.location; if ((this.tarActor != 0) && (this.tarActor.handle.CharInfo != null)) { CActorInfo charInfo = this.tarActor.handle.CharInfo; this.hitHeight = charInfo.iBulletHeight; VInt3 a = this.moveActor.handle.location - this.destPosition; a.y = 0; a = a.NormalizeTo(0x3e8); this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 0x3e8L); } this.destPosition.y += this.hitHeight; } this.moveDirection = this.destPosition - location; this.lerpDirection = this.moveDirection; if (this.bMoveRotate) { this.RotateMoveBullet(this.moveDirection); } int newMagn = 0; if (!this.shouldUseAcceleration) { newMagn = (this.velocity * delta) / 0x3e8; } else { long num4 = (this.lastVelocity * delta) + ((((this.acceleration * delta) * delta) / 2L) / 0x3e8L); num4 /= 0x3e8L; newMagn = (int)num4; this.lastVelocity += (this.acceleration * delta) / 0x3e8; } if ((newMagn * newMagn) >= this.moveDirection.sqrMagnitudeLong2D) { this.moveActor.handle.location = this.destPosition; this.stopCondtion = true; } else { VInt3 num5; if (this.gravity < 0) { VInt num6; this.moveDirection.y = 0; num5 = location + this.moveDirection.NormalizeTo(newMagn); num5.y += this.gravityControler.GetMotionDeltaDistance(delta); if (PathfindingUtility.GetGroundY(this.destPosition, out num6) && (num5.y < num6.i)) { num5.y = num6.i; } } else { num5 = location + this.moveDirection.NormalizeTo(newMagn); } this.moveActor.handle.location = num5; } SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (refParamObject != null) { refParamObject.EffectPos = this.moveActor.handle.location; refParamObject.EffectDir = this.moveDirection; } }
private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset) { if (actor == null || this.stopCondtion || this.stopLerpCondtion) { return; } Vector3 vector = Vector3.one; if (this.MoveType == ActorMoveType.RotateBody) { int num = this.rotateBodyDegreeSpeed * (int)nDelta / 1000; this.lerpRotateBodyCurDirDegreeAngle += num; this.lerpRotateBodyCurDirDegreeAngle %= 360; long nom = (long)((float)this.lerpRotateBodyCurDirDegreeAngle * 0.0174532924f * 1000f); VFactor f; VFactor f2; IntMath.sincos(out f, out f2, nom, 1000L); vector.x = this.originateActor.handle.myTransform.position.x + (float)(this.rotateBodyRadius * f2); vector.y = (float)this.rotateBodyHeight; vector.z = this.originateActor.handle.myTransform.position.z + (float)(this.rotateBodyRadius * f); } else { int newMagn; if (!this.shouldUseAcceleration) { newMagn = this.velocity * (int)nDelta / 1000; } else { long num2 = (long)this.lastLerpVelocity * (long)((ulong)nDelta) + (long)this.acceleration * (long)((ulong)nDelta) * (long)((ulong)nDelta) / 2L / 1000L; num2 /= 1000L; newMagn = (int)num2; this.lastLerpVelocity += (int)((long)this.acceleration * (long)((ulong)nDelta)) / 1000; } vector = actor.myTransform.position; if (this.gravity < 0) { this.lerpDirection.y = 0; vector += (Vector3)this.lerpDirection.NormalizeTo(newMagn); vector.y += (float)this.gravityControler.GetMotionLerpDistance((int)nDelta) / 1000f; VInt ob; if (PathfindingUtility.GetGroundY(this.destPosition, out ob) && vector.y < (float)ob) { vector.y = (float)ob; } } else { vector += (Vector3)this.lerpDirection.NormalizeTo(newMagn); } if (this.bMoveOnXAxis) { int motionLerpDistance = this.xControler.GetMotionLerpDistance((int)nDelta); VInt3 vInt = this.xDirection; vInt.NormalizeTo(Math.Abs(motionLerpDistance)); if (motionLerpDistance < 0) { vInt = -vInt; } vector += (Vector3)vInt; } } actor.myTransform.position = vector; }
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) ? refParamObject.Originator.handle.TheActorMeta.ActorCamp : COM_PLAYERCAMP.COM_PLAYERCAMP_MID; 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.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.handle.forward; } } else if (this.bTargetPosition) { vInt = this.translation + this.targetPosition; if (this.modifyDirection && refParamObject != null && refParamObject.Originator) { forward = refParamObject.Originator.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.handle, vInt)) { bool flag2 = false; VInt3 vInt2 = PathfindingUtility.FindValidTarget(refParamObject.Originator.handle, vInt, refParamObject.Originator.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.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.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.handle.location = vInt; this.actorRoot.handle.forward = forward; VCollisionShape.InitActorCollision(this.actorRoot, this.m_particleObj, _action.actionName); if (this.actorRoot.handle.shape != null) { this.actorRoot.handle.shape.ConditionalUpdateShape(); } if (this.bInvisibleBullet && this.actorRoot.handle.ActorControl != null) { BulletWrapper bulletWrapper = this.actorRoot.handle.ActorControl as BulletWrapper; if (bulletWrapper != null) { bulletWrapper.InitForInvisibleBullet(); } } 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(Action.PlaySpeedAffectedType.ePSAT_Anim, gameObject3); } if (this.applyActionSpeedToParticle) { _action.AddTempObject(Action.PlaySpeedAffectedType.ePSAT_Fx, gameObject3); } this.actorRoot.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; } } }