protected void Follow() { if (!this.FixNavAgent) { return; } if (!this.IsFollowing) { this.IsFollowing = this.FixNavAgent.Warp(this.FixTransform.get_position()); this.FixNavAgent.set_enabled(true); this.FixNavAgent.set_speed(this.RealMoveSpeed); this.FixNavAgent.set_updatePosition(true); this.FixNavAgent.set_updateRotation(true); this.FixNavAgent.set_angularSpeed(1080f); if (this.IsFollowing && !XUtility.StartsWith(this.CurActionStatus, "run")) { this.CastAction("run"); } } if (this.IsFollowing) { this.FixNavAgent.SetDestination(this.Entity.Owner.Actor.FixTransform.get_position()); this.FixNavAgent.Resume(); } }
public override void OnActionStatusExit(ActionStatusExitCmd cmd) { if (XUtility.StartsWith(cmd.actName, string.Empty)) { return; } this.UpdateActionSpeed(); }
public override bool CanChangeActionTo(string newAction, bool isCheckHitMoving = true, int candidateSkillID = 0, bool isLogOpen = false) { if (string.IsNullOrEmpty(newAction) || string.IsNullOrEmpty(this.CurActionStatus)) { return(true); } if ((this.GetEntity() as EntityMonster).IsComponont && !string.IsNullOrEmpty(newAction)) { newAction += this.ActionStatusPostfix; } return(!this.GetEntity().IsStatic&& (!this.GetEntity().IsFixed || !XUtility.StartsWith(newAction, "run")) && (!isCheckHitMoving || !this.GetEntity().IsHitMoving || ActionStatusName.IsDieAction(newAction)) && (!isCheckHitMoving || !base.IsStraight || ActionStatusName.IsDieAction(newAction) || ActionStatusName.IsHitAction(newAction)) && (!this.GetEntity().IsEndure || !ActionStatusName.IsHitAction(newAction)) && (!this.GetEntity().IsWeak || (!ActionStatusName.IsActionCauseNormalMove(newAction) && !ActionStatusName.IsSpinAction(newAction))) && base.HasActionOrFixAction(newAction) && ((base.IsUnderCombo && base.ActionSkillComboID != 0 && base.ActionSkillComboID == candidateSkillID) || newAction == this.CurActionStatus || base.ActionPriorityTable[newAction] > base.ActionPriorityTable[this.CurActionStatus] || base.IsUnderTermination || ActionStatusName.IsIdleAction(newAction))); }
protected void OnUIAnimationEnd(AnimationEndCmd cmd) { if (XUtility.StartsWith(cmd.actName, "idle") || XUtility.StartsWith(cmd.actName, "die")) { this.DoUIDisplaySkillEnd(); return; } this.ResetAll(); this.RemoveFxs(); if (ControllerTool.SplitIsCity(this.GetAnimator())) { this.PreciseSetAction("idle_city"); } else { this.PreciseSetAction("idle"); } this.DoUIDisplaySkillEnd(); }
public bool TurnToRandomDir(float angle1, float angle2) { if (this.owner.IsWeak) { return(true); } if (!this.ownerActor) { return(true); } if (this.ownerActor.IsLockModelDir) { return(true); } if (!XUtility.StartsWith(this.ownerActor.CurActionStatus, "idle")) { return(true); } this.ownerActor.ForceSetDirection(Quaternion.Euler(this.ownerActor.FixTransform.get_eulerAngles().x, this.ownerActor.FixTransform.get_eulerAngles().y + Random.Range(angle1, angle2), this.ownerActor.FixTransform.get_eulerAngles().z) * Vector3.get_forward()); this.ownerActor.ApplyMovingDirAsForward(); return(true); }
protected override void UpdateMoveByPointState(float deltaTime) { if (base.IsMovePausing) { if (!this.IsClearTargetPosition && !this.GetEntity().IsStatic&& !this.GetEntity().IsDizzy&& !this.GetEntity().IsWeak&& (XUtility.StartsWith(this.CurActionStatus, "run") || XUtility.StartsWith(this.CurActionStatus, "idle") || this.GetEntity().IsMoveCast) && base.ToCorner < base.NavMeshPath.get_corners().Length) { base.IsMovePausing = false; base.FixTransform.LookAt(new Vector3(base.NavMeshPath.get_corners()[base.ToCorner].x, base.FixTransform.get_position().y, base.NavMeshPath.get_corners()[base.ToCorner].z)); base.LeftLength = XUtility.DistanceNoY(base.FixTransform.get_position(), base.NavMeshPath.get_corners()[base.ToCorner]); if (this.CanChangeActionTo("run", true, 0, false)) { this.ChangeAction("run", false, true, 1f, 0, 0, string.Empty); } } } else { base.CalculateNextPace(deltaTime); if ((this.CurActionStatus != "run" && this.CurActionStatus != "idle" && !this.GetEntity().IsMoveCast) || this.GetEntity().IsStatic || this.GetEntity().IsDizzy || this.GetEntity().IsWeak) { base.IsMovePausing = true; base.MovingDirection = Vector3.get_zero(); } else if (XUtility.DistanceNoY(base.FixTransform.get_position(), base.NavMeshPosition) <= 0.05f || base.ToCorner == base.NavMeshPath.get_corners().Length || (base.NextPace >= base.LeftLength && base.ToCorner == base.NavMeshPath.get_corners().Length - 1)) { if (!this.IsClearTargetPosition) { this.IsClearTargetPosition = true; base.MovingDirection = Vector3.get_zero(); base.FixTransform.set_position(new Vector3(base.NavMeshPosition.x, base.FixTransform.get_position().y, base.NavMeshPosition.z)); TimerHeap.DelTimer(this.stopTimer); this.stopTimer = TimerHeap.AddTimer(350u, 0, delegate { if (this.IsClearTargetPosition && XUtility.StartsWith(this.CurActionStatus, "run")) { this.ChangeAction("idle", false, true, 1f, 0, 0, string.Empty); } }); } } else if (base.NavMeshPath.get_corners().Length > 0 && (XUtility.DistanceNoY(base.FixTransform.get_position(), base.NavMeshPath.get_corners()[base.ToCorner]) <= 0.05f || base.NextPace > base.LeftLength)) { if (!this.IsClearTargetPosition) { base.FixTransform.set_position(new Vector3(base.NavMeshPath.get_corners()[base.ToCorner].x, base.FixTransform.get_position().y, base.NavMeshPath.get_corners()[base.ToCorner].z)); base.ToCorner++; base.MovingDirection = Vector3.get_zero(); if (base.ToCorner < base.NavMeshPath.get_corners().Length) { base.FixTransform.LookAt(new Vector3(base.NavMeshPath.get_corners()[base.ToCorner].x, base.FixTransform.get_position().y, base.NavMeshPath.get_corners()[base.ToCorner].z)); base.LeftLength = XUtility.DistanceNoY(base.FixTransform.get_position(), base.NavMeshPath.get_corners()[base.ToCorner]); } } } else if (!this.IsClearTargetPosition && (XUtility.StartsWith(this.CurActionStatus, "run") || XUtility.StartsWith(this.CurActionStatus, "idle") || this.GetEntity().IsMoveCast) && base.ToCorner < base.NavMeshPath.get_corners().Length) { Vector3 vector = new Vector3(base.NavMeshPath.get_corners()[base.ToCorner].x - base.FixTransform.get_position().x, 0f, base.NavMeshPath.get_corners()[base.ToCorner].z - base.FixTransform.get_position().z); base.MovingDirection = vector.get_normalized(); base.FixTransform.LookAt(new Vector3(base.NavMeshPath.get_corners()[base.ToCorner].x, base.FixTransform.get_position().y, base.NavMeshPath.get_corners()[base.ToCorner].z)); } } }
private void Update() { if (!XInputManager.EnabledLogic) { return; } if (RTManager.Instance.RTIsUI()) { return; } if (!MySceneManager.Instance.IsSceneExist) { return; } if (!this.Actor) { return; } if (this.Actor.GetEntity() == null) { return; } if (this.Actor.GetEntity().IsStatic || this.Actor.GetEntity().IsDizzy || this.Actor.GetEntity().IsWeak || this.Actor.GetEntity().IsFusing || this.Actor.GetEntity().IsHitMoving || this.Actor.GetEntity().IsAssault) { return; } if (GlobalBattleNetwork.Instance.IsServerEnable) { this.tiltAroundX = ControlStick.Direction2ControlStick.x; this.tiltAroundZ = ControlStick.Direction2ControlStick.y; } else { this.tiltAroundX = 0f; this.tiltAroundZ = 0f; } if (Input.GetAxis("Horizontal") != 0f || Input.GetAxis("Vertical") != 0f) { this.tiltAroundX = Input.GetAxis("Horizontal"); this.tiltAroundZ = Input.GetAxis("Vertical"); } if (this.tiltAroundX != 0f || this.tiltAroundZ != 0f) { this.currentDragDirection = (this.Actor.get_transform().get_position() - this.MainCamera.get_transform().get_position()).get_normalized(); this.currentDragDirection.y = 0f; this.angle = Mathf.Atan2(this.tiltAroundZ, this.tiltAroundX) * 57.29578f; Quaternion quaternion = Quaternion.AngleAxis(-this.angle, Vector3.get_up()); this.currentDragDirection = quaternion * CamerasMgr.MainCameraRoot.get_right(); this.currentDragDirection.y = 0f; this.Actor.MovingSpeed = this.Actor.RealMoveSpeed; this.Actor.MovingDirection = this.CurrentDragDirection; this.Actor.ApplyMovingDirAsForward(); if (!XInputManager.IsDragging) { SelfAIControlManager.Instance.OnBeginDrag(); } if (this.Actor.CanChangeActionTo("run", true, 0, false)) { if (EntityWorld.Instance.EntSelf.CheckCancelNavToNPC()) { MainTaskManager.Instance.StopToNPC(true); } if (RadarManager.Instance.CheckIsNavByRadar()) { RadarManager.Instance.StopNav(); } if (GuildWarManager.Instance.CheckIsNavToMine()) { GuildWarManager.Instance.StopNavToMine(); } } this.Actor.CastAction("run", true, 1f, 0, 0, string.Empty); XInputManager.IsDragging = true; } else { if (this.Actor.IsClearTargetPosition) { this.Actor.MovingSpeed = 0f; if (XUtility.StartsWith(this.Actor.CurActionStatus, "run")) { this.Actor.CastAction("idle", true, 1f, 0, 0, string.Empty); } if (XInputManager.IsDragging) { this.Actor.CheckSendPrecisePosOnReleaseDrag(); } } if (XInputManager.IsDragging) { SelfAIControlManager.Instance.OnFinishDrag(); } XInputManager.IsDragging = false; } this.CheckSkillKeyInput(); }
public void ServerHandleHit(long casterID, int effectID, string hitAction, int actionPriority, bool isKnock, Vector3 toPos, bool isManage, int oldManageState, int uniqueID) { if (isManage) { this.owner.CheckCancelManage(casterID, oldManageState, true); } Effect effect = DataReader <Effect> .Get(effectID); if (effect == null) { return; } bool flag = XUtility.StartsWith(hitAction, "float"); if (this.owner.IsSuspended != flag) { this.owner.IsSuspended = flag; } if (isKnock) { if (this.IsOpenLog) { Debug.LogError("Fuck1"); } if (!this.owner.IsHitMoving) { this.owner.IsHitMoving = true; } Action <Vector3, Vector3> callback = null; if (isManage) { callback = delegate(Vector3 pos, Vector3 dir) { GlobalBattleNetwork.Instance.SendEndKnock(this.owner.ID, pos, dir, uniqueID); }; } if (effect.hitMove != null && effect.hitMove.get_Count() > 1) { Debuger.Error(string.Concat(new object[] { "hitMove 1: ", this.ownerActor.FixTransform.get_position().x - toPos.x, " ", this.ownerActor.FixTransform.get_position().z - toPos.z }), new object[0]); ActorParent arg_1CC_0 = this.ownerActor; Vector3 vector = new Vector3(this.ownerActor.FixTransform.get_position().x - toPos.x, 0f, this.ownerActor.FixTransform.get_position().z - toPos.z); arg_1CC_0.ServerPlayHitMove(hitAction, vector.get_normalized(), XUtility.DistanceNoY(toPos, this.ownerActor.FixTransform.get_position()), effect.hitMove.get_Item(1), effect.hitstraight, actionPriority, callback); } else { Debuger.Error(string.Concat(new object[] { "hitMove 2: ", this.ownerActor.FixTransform.get_position().x - toPos.x, " ", this.ownerActor.FixTransform.get_position().z - toPos.z }), new object[0]); ActorParent arg_2CF_0 = this.ownerActor; Vector3 vector2 = new Vector3(this.ownerActor.FixTransform.get_position().x - toPos.x, 0f, this.ownerActor.FixTransform.get_position().z - toPos.z); arg_2CF_0.ServerPlayHitMove(hitAction, vector2.get_normalized(), XUtility.DistanceNoY(toPos, this.ownerActor.FixTransform.get_position()), 0f, effect.hitstraight, actionPriority, callback); } } else { object arg_338_0 = "hitMove 3: "; Vector3 vector3 = new Vector3(this.ownerActor.FixTransform.get_position().x - toPos.x, 0f, this.ownerActor.FixTransform.get_position().z - toPos.z); Debuger.Error(arg_338_0 + vector3.get_normalized(), new object[0]); this.ownerActor.ServerPlayHit(hitAction, effect.hitstraight, actionPriority, false); } }
public static bool IsActionCauseNormalMove(string actionName) { return(XUtility.StartsWith(actionName, "run") || XUtility.StartsWith(actionName, "swing")); }
public static bool IsSpinAction(string actionName) { return(XUtility.StartsWith(actionName, "turn")); }
public static bool IsVictoryAction(string actionName) { return(XUtility.StartsWith(actionName, "victory")); }
public static bool IsDieAction(string actionName) { return(XUtility.StartsWith(actionName, "die")); }
public static bool IsHitAction(string actionName) { return(XUtility.StartsWith(actionName, "hit") || XUtility.StartsWith(actionName, "float")); }
public static bool IsSkillChargeAction(string actionName) { return(XUtility.StartsWith(actionName, "skillCharge")); }
public static bool IsSkillAction(string actionName) { return(XUtility.StartsWith(actionName, "attack") || XUtility.StartsWith(actionName, "skill") || XUtility.StartsWith(actionName, "exchange") || XUtility.StartsWith(actionName, "fuse") || XUtility.StartsWith(actionName, "roll")); }
public static bool IsIdleAction(string actionName) { return(XUtility.StartsWith(actionName, "idle") || XUtility.StartsWith(actionName, "stand")); }