public override void Leave(Action _action, Track _track) { base.Leave(_action, _track); if (this.actorObj) { this.RecoverAnimation(); if (this.forbidMove) { this.actorObj.handle.ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_Move); } if (this.IsFreeze) { this.actorObj.handle.ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_Freeze); } if (this.forbidSkill) { this.actorObj.handle.ActorControl.RmvDisableSkillFlag(SkillSlotType.SLOT_SKILL_COUNT, false); } if (this.freezeHeight > 0 && this.actorObj.handle.isMovable) { VInt vInt = 0; VInt3 location = this.actorObj.handle.location; location.y -= this.freezeHeight; PathfindingUtility.GetGroundY(location, out vInt); if (location.y < vInt.i) { location.y = vInt.i; } this.actorObj.handle.location = location; } } }
protected override void OnRevive() { VInt num3; VInt3 zero = VInt3.zero; VInt3 forward = VInt3.forward; if (this.autoRevived && this.m_reviveContext.bBaseRevive) { Singleton <BattleLogic> .GetInstance().mapLogic.GetRevivePosDir(ref base.actor.TheActorMeta, false, out zero, out forward); base.actor.EquipComponent.ResetHasLeftEquipBoughtArea(); } else { Player player = ActorHelper.GetOwnerPlayer(ref this.actorPtr); zero = player.Captain.handle.location; forward = player.Captain.handle.forward; } if (PathfindingUtility.GetGroundY(zero, out num3)) { base.actor.groundY = num3; zero.y = num3.i; } base.actor.forward = forward; base.actor.location = zero; base.actor.ObjLinker.SetForward(forward, -1); base.OnRevive(); Player ownerPlayer = ActorHelper.GetOwnerPlayer(ref this.actorPtr); if (ownerPlayer != null) { Singleton <EventRouter> .instance.BroadCastEvent <Player>(EventID.PlayerReviveTime, ownerPlayer); } }
public void GravityMoveLerp(int _deltaTime, bool bReset) { int motionLerpDistance = 0; Vector3 zero = Vector3.zero; SpecialMotionControler controler = null; if (this.Movement != null) { VInt num2; if (this.motionControlers.Count != 0) { this.Movement.isLerpFlying = true; zero = this.Movement.actor.gameObject.transform.position; PathfindingUtility.GetGroundY((VInt3)zero, out num2); for (int i = 0; i < this.motionControlers.Count; i++) { controler = this.motionControlers[i]; motionLerpDistance += controler.GetMotionLerpDistance(_deltaTime); } zero.y += ((float)motionLerpDistance) / 1000f; if (((float)num2) > zero.y) { zero.y = (float)num2; this.Movement.actor.gameObject.transform.position = zero; } else { this.Movement.actor.gameObject.transform.position = zero; } } else if (this.Movement.isLerpFlying) { zero = this.Movement.actor.gameObject.transform.position; PathfindingUtility.GetGroundY((VInt3)zero, out num2); if (((float)num2) >= zero.y) { zero.y = (float)num2; this.Movement.actor.gameObject.transform.position = zero; this.Movement.isLerpFlying = false; this.gravityControler.ResetLerpTime(); } else { motionLerpDistance = this.gravityControler.GetMotionLerpDistance(_deltaTime); zero.y += ((float)motionLerpDistance) / 1000f; if (((float)num2) > zero.y) { zero.y = (float)num2; this.Movement.actor.gameObject.transform.position = zero; this.Movement.isLerpFlying = false; this.gravityControler.ResetLerpTime(); } else { this.Movement.actor.gameObject.transform.position = zero; } } } } }
public void Teleport() { VInt groundY = this.actor_.get_handle().groundY; VInt3 vInt = this.dir.NormalizeTo(this.moveDistance); VInt3 vInt2 = this.actor_.get_handle().location + vInt; bool flag = false; if (PathfindingUtility.IsValidTarget(this.actor_, vInt2)) { PathfindingUtility.GetGroundY(vInt2, out groundY); vInt2.y = groundY.i; this.actor_.get_handle().location = vInt2; } else { VInt3 vInt3 = PathfindingUtility.FindValidTarget(this.actor_, vInt2, this.actor_.get_handle().location, 10000, out flag); if (flag) { PathfindingUtility.GetGroundY(vInt3, out groundY); vInt3.y = groundY.i; this.actor_.get_handle().location = vInt3; } else { vInt = PathfindingUtility.Move(this.actor_.get_handle(), vInt, out groundY, out this.actor_.get_handle().hasReachedNavEdge, null); this.actor_.get_handle().location += vInt; } } if (this.bUseRecordPosition) { this.actor_.get_handle().ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect); } this.actor_.get_handle().groundY = groundY; this.done_ = true; }
private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset) { if (actor == null || this.stopCondtion) { return; } VInt3 location = actor.location; VInt3 vInt = this.destPosition - location; int num = this.velocity * (int)nDelta / 1000; Vector3 vector = actor.myTransform.position; if (this.gravity < 0) { vInt.y = 0; vector += (Vector3)vInt.NormalizeTo(num); vector.y += (float)this.gravityControler.GetMotionLerpDistance((int)nDelta) / 1000f; VInt vInt2; if (PathfindingUtility.GetGroundY((VInt3)vector, out vInt2) && vector.y < (float)vInt2) { vector.y = (float)vInt2; } } else { vector += (Vector3)vInt.NormalizeTo(num); } actor.myTransform.position = vector; }
public override void Enter(Action _action, Track _track) { base.Enter(_action, _track); this.actorObj = _action.GetActorHandle(this.targetId); if (!this.actorObj) { return; } ObjWrapper actorControl = this.actorObj.get_handle().ActorControl; if (actorControl == null) { return; } this.PauseAnimation(); actorControl.TerminateMove(); actorControl.ClearMoveCommand(); actorControl.ForceAbortCurUseSkill(); this.actorObj.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Move); this.actorObj.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Freeze); this.actorObj.get_handle().ActorControl.AddDisableSkillFlag(SkillSlotType.SLOT_SKILL_COUNT, false); if (this.freezeHeight > 0 && this.actorObj.get_handle().isMovable) { VInt vInt = 0; VInt3 location = this.actorObj.get_handle().location; PathfindingUtility.GetGroundY(location, out vInt); location.y = vInt.i + this.freezeHeight; this.actorObj.get_handle().location = location; } }
private void SetFinalPos() { if (!this.bStayInCurrentPosWhenStop) { VInt vInt = 0; PathfindingUtility.GetGroundY(this.finalPos, out vInt); this.finalPos.y = vInt.i; this.actor_.handle.location = this.finalPos; } else if (!PathfindingUtility.IsValidTarget(this.actor_, this.actor_.handle.location)) { bool flag = false; VInt3 vInt2 = VInt3.zero; vInt2 = PathfindingUtility.FindValidTarget(this.actor_, this.actor_.handle.location, this.finalPos, 10000, out flag); if (!flag) { vInt2 = PathfindingUtility.FindValidTarget(this.actor_, this.actor_.handle.location, this.srcPos, 10000, out flag); } if (flag) { VInt vInt3 = 0; PathfindingUtility.GetGroundY(vInt2, out vInt3); vInt2.y = vInt3.i; this.finalPos = vInt2; this.actor_.handle.location = vInt2; } else { this.actor_.handle.location = this.finalPos; } } }
private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset) { if ((actor != null) && !this.stopCondtion) { Vector3 one = Vector3.one; int newMagn = (int)((this.velocity * nDelta) / 0x3e8); one = actor.gameObject.transform.position; if (this.gravity < 0) { VInt num2; this.lerpDirection.y = 0; one += (Vector3)this.lerpDirection.NormalizeTo(newMagn); one.y += ((float)this.gravityControler.GetMotionLerpDistance((int)nDelta)) / 1000f; if (PathfindingUtility.GetGroundY(this.destPosition, out num2) && (one.y < ((float)num2))) { one.y = (float)num2; } } else { one += (Vector3)this.lerpDirection.NormalizeTo(newMagn); } actor.gameObject.transform.position = one; } }
private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset) { if ((actor != null) && !this.stopCondtion) { VInt3 location = actor.location; VInt3 num2 = this.destPosition - location; int newMagn = (int)((this.velocity * nDelta) / 0x3e8); Vector3 position = actor.gameObject.transform.position; if (this.gravity < 0) { VInt num4; num2.y = 0; position += (Vector3)num2.NormalizeTo(newMagn); position.y += ((float)this.gravityControler.GetMotionLerpDistance((int)nDelta)) / 1000f; if (PathfindingUtility.GetGroundY((VInt3)position, out num4) && (position.y < ((float)num4))) { position.y = (float)num4; } } else { position += (Vector3)num2.NormalizeTo(newMagn); } actor.gameObject.transform.position = position; } }
public void ProcessInner(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 = (this.velocity * delta) / 0x3e8; if ((newMagn * newMagn) >= this.moveDirection.sqrMagnitudeLong2D) { this.moveActor.handle.location = this.destPosition; this.stopCondtion = true; } else { VInt3 num4; if (this.gravity < 0) { VInt num5; this.moveDirection.y = 0; num4 = location + this.moveDirection.NormalizeTo(newMagn); num4.y += this.gravityControler.GetMotionDeltaDistance(delta); if (PathfindingUtility.GetGroundY(this.destPosition, out num5) && (num4.y < num5.i)) { num4.y = num5.i; } } else { num4 = location + this.moveDirection.NormalizeTo(newMagn); } this.moveActor.handle.location = num4; } SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext"); if (refParamObject != null) { refParamObject.EffectPos = this.moveActor.handle.location; refParamObject.EffectDir = this.moveDirection; } }
private void SetFinalPos() { VInt vInt = 0; PathfindingUtility.GetGroundY(this.finalPos, out vInt); this.finalPos.y = vInt.i; this.actor_.get_handle().location = this.finalPos; }
private void SetFinalPos() { VInt groundY = 0; PathfindingUtility.GetGroundY(this.finalPos, out groundY); this.finalPos.y = groundY.i; this.actor_.handle.location = this.finalPos; }
protected override void OnRevive() { VInt3 vInt = VInt3.zero; VInt3 forward = VInt3.forward; if (this.autoRevived && this.m_reviveContext.bBaseRevive && !base.GetNoAbilityFlag(ObjAbilityType.ObjAbility_DeadControl)) { Singleton <BattleLogic> .GetInstance().mapLogic.GetRevivePosDir(ref this.actor.TheActorMeta, false, out vInt, out forward); this.actor.EquipComponent.ResetHasLeftEquipBoughtArea(); } else { Player ownerPlayer = ActorHelper.GetOwnerPlayer(ref this.actorPtr); vInt = ownerPlayer.Captain.get_handle().location; forward = ownerPlayer.Captain.get_handle().forward; } DefaultGameEventParam defaultGameEventParam = new DefaultGameEventParam(this.actorPtr, this.actorPtr); Singleton <GameEventSys> .get_instance().SendEvent <DefaultGameEventParam>(GameEventDef.Event_ActorClearMove, ref defaultGameEventParam); VInt groundY; if (PathfindingUtility.GetGroundY(vInt, out groundY)) { this.actor.groundY = groundY; vInt.y = groundY.i; } this.actor.forward = forward; this.actor.location = vInt; this.actor.ObjLinker.SetForward(forward, -1); base.OnRevive(); if (!this.actor.ActorAgent.IsAutoAI()) { base.SetObjBehaviMode(ObjBehaviMode.State_Revive); } Player ownerPlayer2 = ActorHelper.GetOwnerPlayer(ref this.actorPtr); if (ownerPlayer2 != null) { Singleton <EventRouter> .get_instance().BroadCastEvent <Player>(EventID.PlayerReviveTime, ownerPlayer2); } if (this.bDeadLevelUp) { this.OnAdvanceSkin(); this.bDeadLevelUp = false; } }
public override void Process(Action _action, Track _track, int _localTime) { base.Process(_action, _track, _localTime); if (!this.triggerActor || !this.targetActor || (this.moveSpeed == 0 && this.acceleration == 0)) { return; } if (this.done_) { return; } VInt3 location = this.triggerActor.handle.location; VInt3 vInt = this.targetActor.handle.location; int num = _localTime - this.lastTime_; this.lastTime_ = _localTime; VInt3 vInt2 = vInt - location; long num2 = (long)this.curSpeed * (long)num + (long)this.acceleration * (long)num * (long)num / 2L / 1000L; this.curSpeed = Mathf.Min(this.curSpeed + this.acceleration * num / 1000, this.maxMoveSpeed); this.curLerpSpeed = this.curSpeed; num2 /= 1000L; if (num2 >= (long)(vInt2.magnitude - this.lastDistance)) { num2 = (long)Mathf.Max(vInt2.magnitude - this.lastDistance, 0); this.done_ = true; vInt = location + vInt2.NormalizeTo((int)num2); if (!PathfindingUtility.IsValidTarget(this.triggerActor.handle, vInt)) { bool flag = false; VInt3 vInt3 = PathfindingUtility.FindValidTarget(this.triggerActor.handle, vInt, this.triggerActor.handle.location, 10000, out flag); VInt vInt4 = 0; PathfindingUtility.GetGroundY(vInt3, out vInt4); vInt3.y = vInt4.i; vInt = vInt3; vInt2 = vInt - this.triggerActor.handle.location; num2 = (long)vInt2.magnitude; } } this.dir = vInt2; if (vInt2 != VInt3.zero) { this.triggerActor.handle.MovementComponent.SetRotate(this.dir, true); this.triggerActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt2); } this.triggerActor.handle.location += vInt2.NormalizeTo((int)num2); }
private void send_signal(CUIEvent uiEvent, GameObject img, int signal_id = 0) { if ((uiEvent != null) && (img != null)) { byte tag = (byte)uiEvent.m_eventParams.tag; byte type = (byte)uiEvent.m_eventParams.tag2; uint tagUInt = 0; uint targetHeroID = 0; if (signal_id == 0) { signal_id = uiEvent.m_eventParams.tag3; } if (type == 3) { tagUInt = uiEvent.m_eventParams.tagUInt; targetHeroID = uiEvent.m_eventParams.heroId; } Singleton <CBattleSystem> .instance.GetMinimapSys().Switch(EMapType.Mini); Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); if (hostPlayer != null) { ActorRoot root = ((hostPlayer == null) || (hostPlayer.Captain == 0)) ? null : hostPlayer.Captain.handle; if (root != null) { VInt num5; Vector2 vector = CUIUtility.WorldToScreenPoint(uiEvent.m_srcFormScript.GetCamera(), img.transform.position); Vector3 zero = Vector3.zero; zero.x = (uiEvent.m_pointerEventData.position.x - vector.x) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Big.x; zero.y = (root == null) ? 0.15f : ((Vector3)root.location).y; zero.z = (uiEvent.m_pointerEventData.position.y - vector.y) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Big.y; PathfindingUtility.GetGroundY((VInt3)zero, out num5); zero.y = num5.scalar; SignalPanel signalPanel = Singleton <CBattleSystem> .instance.GetSignalPanel(); if (signalPanel != null) { signalPanel.SendFrameCommand(signal_id, (int)zero.x, (int)zero.y, (int)zero.z, tag, type, tagUInt, targetHeroID); } } } } }
public void ExecCommand(IFrameCommand cmd) { Player player = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(cmd.playerID); if (player != null && player.Captain) { SkillUseParam skillUseParam = default(SkillUseParam); VInt3 vInt = new VInt3(this.Position.x, 0, this.Position.y); VInt vInt2 = 0; if (PathfindingUtility.GetGroundY(vInt, out vInt2)) { vInt.y = vInt2.i; } skillUseParam.Init(this.SlotType, vInt); player.Captain.handle.ActorControl.CmdUseSkill(cmd, ref skillUseParam); } }
public void OnClickMiniMap(CUIEvent uiEvent) { if ((this.m_useSignalButton && (this.m_selectedSignalID >= 0)) && (this.m_miniMap != null)) { VInt num; Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); ActorRoot root = (hostPlayer != null) ? hostPlayer.Captain.handle : null; this.m_miniMapScreenPosition = CUIUtility.WorldToScreenPoint(uiEvent.m_srcFormScript.GetCamera(), this.m_miniMap.transform.position); Vector3 zero = Vector3.zero; zero.x = (uiEvent.m_pointerEventData.position.x - this.m_miniMapScreenPosition.x) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Small.x; zero.y = (root == null) ? 0.15f : ((Vector3)root.location).y; zero.z = (uiEvent.m_pointerEventData.position.y - this.m_miniMapScreenPosition.y) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Small.y; PathfindingUtility.GetGroundY((VInt3)zero, out num); zero.y = num.scalar; this.SendFrameCommand(this.m_selectedSignalID, (int)zero.x, (int)zero.y, (int)zero.z, 0, 0, 0, 0); } }
public void Teleport(VInt3 pos, VInt3 dir) { this.myTransform.position = (Vector3)pos; this.myTransform.rotation = Quaternion.LookRotation((Vector3)dir); this.myTransform.parent = MonoSingleton <SceneMgr> .GetInstance().GetRoot((SceneObjType)this.TheActorMeta.ActorType).transform; this.location = pos; this.forward = dir; this.rotation = this.myTransform.rotation; this.ObjLinker.SetForward(dir, -1); VInt vInt; if (this.TheActorMeta.ActorType < ActorTypeDef.Actor_Type_Bullet && PathfindingUtility.GetGroundY(this, out vInt)) { this.groundY = vInt; VInt3 location = this.location; location.y = this.groundY.i; this.location = location; } }
public override void Leave(Action _action, Track _track) { base.Leave(_action, _track); if (!this.triggerActor || !this.targetActor || this.moveSpeed == 0) { return; } this.done_ = true; this.triggerActor.get_handle().ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_Move); this.triggerActor.get_handle().ObjLinker.RmvCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp)); if (!PathfindingUtility.IsValidTarget(this.triggerActor.get_handle(), this.triggerActor.get_handle().location)) { bool flag = false; VInt3 vInt = PathfindingUtility.FindValidTarget(this.triggerActor.get_handle(), this.targetActor.get_handle().location, this.triggerActor.get_handle().location, 10000, out flag); VInt vInt2 = 0; PathfindingUtility.GetGroundY(vInt, out vInt2); vInt.y = vInt2.i; this.triggerActor.get_handle().location = vInt; } }
private bool InitGravity() { int num = (int)IntMath.Divide((long)(this.destPosition - this.moveActor.get_handle().location).get_magnitude2D() * 1000L, (long)this.velocity); if (num == 0) { return(false); } VInt vInt = 0; if (PathfindingUtility.GetGroundY(this.destPosition, out vInt)) { this.gravityControler.InitMotionControler(num, vInt.i - this.moveActor.get_handle().location.y, this.gravity); } else { this.gravityControler.InitMotionControler(num, 0, this.gravity); } return(true); }
public void Teleport() { VInt groundY = this.actor_.handle.groundY; VInt3 delta = this.dir.NormalizeTo(this.moveDistance); VInt3 target = this.actor_.handle.location + delta; if (PathfindingUtility.IsValidTarget((ActorRoot)this.actor_, target)) { PathfindingUtility.GetGroundY(target, out groundY); target.y = groundY.i; this.actor_.handle.location = target; } else { delta = PathfindingUtility.Move(this.actor_.handle, delta, out groundY, out this.actor_.handle.hasReachedNavEdge); ActorRoot handle = this.actor_.handle; handle.location += delta; } this.actor_.handle.groundY = groundY; this.done_ = true; }
private bool InitGravity() { VInt3 num = this.destPosition - this.moveActor.handle.location; int num2 = (int)IntMath.Divide((long)(num.magnitude2D * 0x3e8L), (long)this.velocity); if (num2 == 0) { return(false); } VInt groundY = 0; if (PathfindingUtility.GetGroundY(this.destPosition, out groundY)) { this.gravityControler.InitMotionControler(num2, groundY.i - this.moveActor.handle.location.y, this.gravity); } else { this.gravityControler.InitMotionControler(num2, 0, this.gravity); } return(true); }
public override void Leave(AGE.Action _action, Track _track) { base.Leave(_action, _track); if (this.actorObj != 0) { this.RecoverAnimation(); this.actorObj.handle.ActorControl.RmvNoAbilityFlag(ObjAbilityType.ObjAbility_Move); this.actorObj.handle.ActorControl.RmvDisableSkillFlag(SkillSlotType.SLOT_SKILL_COUNT); if ((this.freezeHeight > 0) && this.actorObj.handle.isMovable) { VInt groundY = 0; VInt3 location = this.actorObj.handle.location; location.y -= this.freezeHeight; PathfindingUtility.GetGroundY(location, out groundY); if (location.y < groundY.i) { location.y = groundY.i; } this.actorObj.handle.location = location; } } }
private void MoveCity() { if (this.actorObj != 0) { VInt3 zero = VInt3.zero; VInt3 outPosWorld = VInt3.zero; if (Singleton <BattleLogic> .GetInstance().mapLogic.GetRevivePosDir(ref this.actorObj.handle.TheActorMeta, true, out outPosWorld, out zero)) { VInt num3; if (PathfindingUtility.GetGroundY(outPosWorld, out num3)) { this.actorObj.handle.groundY = num3; outPosWorld.y = num3.i; } this.actorObj.handle.forward = zero; this.actorObj.handle.location = outPosWorld; this.actorObj.handle.ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_MoveCity); DefaultGameEventParam prm = new DefaultGameEventParam(this.actorObj, this.actorObj); Singleton <GameEventSys> .instance.SendEvent <DefaultGameEventParam>(GameEventDef.Event_ActorMoveCity, ref prm); } } }
private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset) { if (actor == null || this.stopCondtion || this.stopLerpCondtion) { return; } Vector3 vector = Vector3.one; int num; if (!this.shouldUseAcceleration) { num = 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; num = (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(num); vector.y += (float)this.gravityControler.GetMotionLerpDistance((int)nDelta) / 1000f; VInt vInt; if (PathfindingUtility.GetGroundY(this.destPosition, out vInt) && vector.y < (float)vInt) { vector.y = (float)vInt; } } else { vector += (Vector3)this.lerpDirection.NormalizeTo(num); } actor.myTransform.position = vector; }
private void MoveCity() { if (!this.actorObj) { return; } VInt3 zero = VInt3.zero; VInt3 zero2 = VInt3.zero; if (Singleton <BattleLogic> .GetInstance().mapLogic.GetRevivePosDir(ref this.actorObj.get_handle().TheActorMeta, true, out zero2, out zero)) { VInt groundY; if (PathfindingUtility.GetGroundY(zero2, out groundY)) { this.actorObj.get_handle().groundY = groundY; zero2.y = groundY.i; } this.actorObj.get_handle().forward = zero; this.actorObj.get_handle().location = zero2; this.actorObj.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect); DefaultGameEventParam defaultGameEventParam = new DefaultGameEventParam(this.actorObj, this.actorObj); Singleton <GameEventSys> .get_instance().SendEvent <DefaultGameEventParam>(GameEventDef.Event_ActorMoveCity, ref defaultGameEventParam); } }
private void ActionMoveLerp(ActorRoot actor, uint nDelta, bool bReset) { if (((actor != null) && !this.stopCondtion) && !this.stopLerpCondtion) { Vector3 one = Vector3.one; int newMagn = 0; if (!this.shouldUseAcceleration) { newMagn = (int)((this.velocity * nDelta) / 0x3e8); } else { long num2 = (this.lastLerpVelocity * nDelta) + ((long)((((this.acceleration * nDelta) * nDelta) / ((ulong)2L)) / ((ulong)0x3e8L))); num2 /= 0x3e8L; newMagn = (int)num2; this.lastLerpVelocity += ((int)(this.acceleration * nDelta)) / 0x3e8; } one = actor.gameObject.transform.position; if (this.gravity < 0) { VInt num3; this.lerpDirection.y = 0; one += (Vector3)this.lerpDirection.NormalizeTo(newMagn); one.y += ((float)this.gravityControler.GetMotionLerpDistance((int)nDelta)) / 1000f; if (PathfindingUtility.GetGroundY(this.destPosition, out num3) && (one.y < ((float)num3))) { one.y = (float)num3; } } else { one += (Vector3)this.lerpDirection.NormalizeTo(newMagn); } actor.gameObject.transform.position = one; } }
public void OnClickMiniMap(CUIEvent uiEvent) { if (!this.m_useSignalButton || this.m_selectedSignalID < 0 || this.m_miniMap == null) { return; } Player hostPlayer = Singleton <GamePlayerCenter> .GetInstance().GetHostPlayer(); ActorRoot actorRoot = (hostPlayer == null) ? null : hostPlayer.Captain.handle; this.m_miniMapScreenPosition = CUIUtility.WorldToScreenPoint(uiEvent.m_srcFormScript.GetCamera(), this.m_miniMap.transform.position); Vector3 zero = Vector3.zero; zero.x = (uiEvent.m_pointerEventData.get_position().x - this.m_miniMapScreenPosition.x) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Small.x; zero.y = ((actorRoot != null) ? ((Vector3)actorRoot.location).y : 0.15f); zero.z = (uiEvent.m_pointerEventData.get_position().y - this.m_miniMapScreenPosition.y) * Singleton <CBattleSystem> .GetInstance().UI_world_Factor_Small.y; VInt vInt; PathfindingUtility.GetGroundY((VInt3)zero, out vInt); zero.y = vInt.scalar; this.SendCommand_SignalMiniMap_Position((byte)this.m_selectedSignalID, (VInt3)zero, MinimapSys.ElementType.None); }
public void LateUpdate(int nDelta) { if (((this.skillSlot != null) && (this.skillSlot.SkillObj != null)) && (this.skillSlot.SkillObj.cfgData != null)) { if ((this.effectHideFrameNum > 0) && (Time.frameCount > this.effectHideFrameNum)) { this.ForceSetGuildPrefabShow(false); this.effectHideFrameNum = 0; } this.pressTime += nDelta; if (this.effectPrefab != null) { if (this.bMoveFlag) { Vector3 vector = (Vector3)((this.deltaDirection * this.moveSpeed) * nDelta); this.deltaPosition += vector; if (this.deltaPosition.magnitude >= this.movePosition.magnitude) { this.bMoveFlag = false; this.useSkillPosition = this.skillSlot.Actor.handle.gameObject.transform.position + this.useOffsetPosition; this.effectPrefab.transform.position = this.useSkillPosition; } else { this.useSkillPosition = this.effectPrefab.transform.position + vector; this.useSkillPosition += this.skillSlot.Actor.handle.gameObject.transform.position - this.rootRosition; this.effectPrefab.transform.position = this.useSkillPosition; this.rootRosition = this.skillSlot.Actor.handle.gameObject.transform.position; } } else { this.useSkillPosition += this.skillSlot.Actor.handle.gameObject.transform.position - this.rootRosition; this.effectPrefab.transform.position = this.useSkillPosition; this.rootRosition = this.skillSlot.Actor.handle.gameObject.transform.position; } if (this.bRotateFlag) { float y = this.rotateSpeed * nDelta; this.deltaAngle += y; if (this.deltaAngle >= this.rotateAngle) { this.bRotateFlag = false; this.useSkillDirection = this.rotateDirection; this.effectPrefab.transform.forward = this.useSkillDirection; } else { Vector3 forward = this.effectPrefab.transform.forward; if (Vector3.Cross(this.useSkillDirection, this.rotateDirection).y < 0f) { forward = (Vector3)(Quaternion.Euler(0f, -y, 0f) * forward); } else { forward = (Vector3)(Quaternion.Euler(0f, y, 0f) * forward); } this.useSkillDirection = forward; this.effectPrefab.transform.forward = this.useSkillDirection; } } VInt groundY = 0; if (PathfindingUtility.GetGroundY((VInt3)this.effectPrefab.transform.position, out groundY)) { Vector3 position = this.effectPrefab.transform.position; position.y = ((float)groundY) + 0.3f; this.effectPrefab.transform.position = position; } } if ((this.effectWarnPrefab != null) && (this.effectPrefab != null)) { this.effectWarnPrefab.transform.position = this.effectPrefab.transform.position; this.effectWarnPrefab.transform.forward = this.effectPrefab.transform.forward; } this.SetUseSkillTarget(); } }
public override void Enter(Action _action, Track _track) { this.done_ = false; this.lastTime_ = 0; base.Enter(_action, _track); this.actor_ = _action.GetActorHandle(this.actorId); if (!this.actor_ || (!this.teleport && this.moveSpeed == 0 && this.acceleration == 0)) { return; } this.srcPos = this.actor_.get_handle().location; if (this.bForbidMoveFollowing) { this.actor_.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect); } if (this.bUseRecordPosition && this.actor_.get_handle().SkillControl != null) { this.destPos = this.actor_.get_handle().SkillControl.RecordPosition; this.dir = this.destPos - this.srcPos; int magnitude2D = (this.destPos - this.srcPos).get_magnitude2D(); this.moveDistance += magnitude2D; } else if (this.moveType == ActorMoveType.Target) { PoolObjHandle <ActorRoot> actorHandle = _action.GetActorHandle(this.destId); if (!this.actor_ || !actorHandle) { this.actor_.Release(); return; } int num; if (actorHandle.get_handle().ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect) && actorHandle.get_handle().TheActorMeta.ActorCamp != this.actor_.get_handle().TheActorMeta.ActorCamp) { num = 0; } else { this.dir = actorHandle.get_handle().location - this.srcPos; num = (actorHandle.get_handle().location - this.srcPos).get_magnitude2D(); } this.moveDistance += num; } else if (this.moveType == ActorMoveType.Position) { this.dir = this.destPos - this.srcPos; int magnitude2D2 = (this.destPos - this.srcPos).get_magnitude2D(); if (magnitude2D2 < this.minMoveDistance) { magnitude2D2 = this.minMoveDistance; } this.moveDistance += magnitude2D2; } else if (this.moveType == ActorMoveType.Directional) { this.dir = this.actor_.get_handle().forward; } this.dir.y = 0; this.actor_.get_handle().ActorControl.TerminateMove(); if (this.bRecordPosition && this.actor_.get_handle().SkillControl != null) { this.actor_.get_handle().SkillControl.RecordPosition = this.actor_.get_handle().location; } if (!this.actor_.get_handle().isMovable || this.dir.get_sqrMagnitudeLong() <= 1L) { this.actor_.Release(); this.done_ = true; return; } VInt3 vInt = this.dir; if (!this.bUseRecordPosition) { this.finalPos = this.srcPos + vInt.NormalizeTo(this.moveDistance); } else { this.finalPos = this.actor_.get_handle().SkillControl.RecordPosition; if (this.teleport) { this.actor_.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_MoveProtect); } } if (!PathfindingUtility.IsValidTarget(this.actor_, this.finalPos)) { bool flag = false; if (this.moveType == ActorMoveType.Directional) { this.IgnoreCollision = false; } else { VInt3 pos = PathfindingUtility.FindValidTarget(this.actor_, this.finalPos, this.actor_.get_handle().location, 10000, out flag); if (!flag) { this.IgnoreCollision = false; } else { VInt vInt2 = 0; PathfindingUtility.GetGroundY(pos, out vInt2); pos.y = vInt2.i; this.finalPos = pos; this.moveDistance = (this.finalPos - this.actor_.get_handle().location).get_magnitude2D(); } } } if (!this.shouldUseAcceleration) { this.moveTick = this.moveDistance * 1000 / this.moveSpeed; } else { long num2 = (long)this.moveDistance; long num3 = (long)this.acceleration; long num4 = (long)this.moveSpeed; this.moveTick = (int)IntMath.Divide(((long)IntMath.Sqrt(num4 * num4 + 2L * num3 * num2) - num4) * 1000L, num3); this.lastMoveSpeed = this.moveSpeed; this.lastLerpMoveSpeed = this.moveSpeed; } this.actor_.get_handle().ActorControl.AddNoAbilityFlag(ObjAbilityType.ObjAbility_Move); this.actor_.get_handle().ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp)); this.fromRot = this.actor_.get_handle().rotation; this.actor_.get_handle().MovementComponent.SetRotate(this.dir, true); if (this.rotationTime > 0) { this.toRot = Quaternion.LookRotation((Vector3)this.actor_.get_handle().forward); } else { this.actor_.get_handle().rotation = Quaternion.LookRotation((Vector3)this.actor_.get_handle().forward); } }