protected void S2C_OnAbilityCancelWarnning(Pt _info) { pt_scene_skill_aleret_cancel_c022 msg = _info as pt_scene_skill_aleret_cancel_c022; if (msg != null) { ObjectType type = (ObjectType)msg.obj_sort; SmartActor user = null; switch (type) { case ObjectType.Player: if ((int)msg.oid == GameCenter.mainPlayerMng.MainPlayerInfo.ServerInstanceID) { user = GameCenter.curMainPlayer; } else { user = GameCenter.curGameStage.GetOtherPlayer((int)msg.oid) as SmartActor; } break; case ObjectType.MOB: user = GameCenter.curGameStage.GetMOB((int)msg.oid) as SmartActor; break; case ObjectType.Entourage: user = GameCenter.curGameStage.GetEntourage((int)msg.oid) as EntourageBase; break; default: break; } if (user != null) { AbilityInstance instance = user.curTryUseAbility; if (instance == null) { return; } if (instance.AbilityID == msg.skill && instance.RuneID == msg.skill_rune && instance.Level == msg.lev && instance.NeedPrepare && !instance.HasServerConfirm) { user.CancelAbility(); } } } }
public override bool Exec(Actor _actor) { if (GameCenter.curGameStage == null || !GameCenter.sceneMng.EnterSucceed) { return(false); } //如果目标在使用技能,返回false ,等他用完 by吴江 SmartActor sa = _actor as SmartActor; if (sa.isRigidity) //如果在僵直 { return(false); } if (sa != null && (sa.isCasting || sa.isCastingAttackEffect)) //如果在使用技能 { sa.CancelAbility(); } if (path == null) { path = GameStageUtility.StartPath(_actor.transform.position, destPos); if (path == null) { GameSys.Log("寻路失败!"); _actor.StopMovingTo(); MainPlayer player = _actor as MainPlayer; if (player != null) { if (player.CannotMoveTo != null) { player.CannotMoveTo(); } } return(true); } else { destPos = path[path.Length - 1]; } } //检查是否超出最远距离 by吴江 if (maxDistance > 0.0f) { Vector3 delta = destPos - _actor.transform.position; if (ignoreY) { delta.y = 0.0f; } if (delta.sqrMagnitude <= (maxDistance * maxDistance)) { _actor.StopMovingTo(); return(true); } } if (firstTime) { if (_actor.isMoveLocked == false) { // firstTimeTick = Time.realtimeSinceStartup; firstTime = false; _actor.MoveTo(path, maxDistance, false); } return(false); } if (maxDistance <= 0.0f) { Vector3 delta = destPos - _actor.transform.position; if (ignoreY) { delta.y = 0.0f; } if (delta.sqrMagnitude < (0.1 * _actor.CurRealSpeed * 0.1 * _actor.CurRealSpeed)) { var player = _actor as SmartActor; if (player != null) { _actor.StopMovingTo(); } return(true); } } if (_actor.IsMoving) { return(false); } else { path = GameStageUtility.StartPath(_actor.transform.position, destPos); _actor.MoveTo(path, maxDistance, false); if (path == null || path.Length == 0) { return(true); } } return(false); }