public override bool Begin(SkillAction action) { base.Begin(action); if (mSkillAction.ActionData.CastStageTime != 0.0f) { if (mSkillAction.ActionData.SkillInfo.ForwardSpeed != 0.0f) { // 将位移回调设置给MoveCtrl,并设置移动速度和方向 MoveCtrl kMoveCtrl = mSkillAction.SkillParent.SrcActor.MoveCtrl; float moveSpeed = mSkillAction.ActionData.SkillInfo.ForwardSpeed * mSkillAction.SkillParent.SpeedScale;// 攻速影响前摇移动速度 mSkillAction.SkillParent.MovingSpeed = moveSpeed; mSkillAction.SkillParent.SrcActor.MoveSpeed = moveSpeed; mSkillAction.BeginMove(); kMoveCtrl.MoveDirInAttacking(mSkillAction.SkillParent.SrcActor.ForwardDir); } mSkillAction.SkillParent.SrcActor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale); return(true); } else { return(false); } }
/// <summary> /// 开始 /// </summary> public override bool Begin(SkillAction action) { base.Begin(action); mSkillAction.SkillParent.SrcActor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale); m_is_should = false; return(true); }
public SkillAction Clone(Skill kSkill) { SkillAction kNewAction = MemberwiseClone() as SkillAction; kNewAction.mSkillParent = kSkill; return(kNewAction); }
/// <summary> /// 获取技能的Action,同时更新Action的结束时间 /// </summary> public SkillAction GetAction(int iIndex) { if (iIndex < GetSkillActionCount()) { SkillAction kAction = mSkillActionList [iIndex]; kAction.UpdateSkillEndPoint(); return(kAction); } return(null); }
protected void LoadFromData(DBSkill.SkillData kSkillData) { SkillData = kSkillData; mSkillActionList = new List <SkillAction>(kSkillData.SkillActionList.Count); foreach (DBSkill.SkillActionData kActionData in kSkillData.SkillActionList) { SkillAction skill_action = new SkillAction(kActionData); skill_action.SkillParent = this; mSkillActionList.Add(skill_action); } }
/// <summary> /// 强制结束这个技能 /// </summary> public void Interrupt() { mCaster.SetCurSkill(null); if (m_CurAction != null) { m_CurAction.Stop(); m_CurAction = null; } mkUpdateFuncList = null; mCurIndex = -1; }
/// <summary> /// 开始技能中的某一Action /// </summary> public void BeginIndex(int index) { // 先中断之前的SkillAction if (m_CurAction != null) { m_CurAction.Stop(); } mkUpdateFuncList = null; m_IsFreeze = false; mfMovingSpeed = 0.0f; mCurIndex = index; m_CurAction = mSkillActionList [mCurIndex]; m_CurAction.Begin(); //if (mCaster is LocalPlayer) //{ // GameDebug.LogError("BeginIndex: " + SkillID + ", " + mCurIndex); //} }
/// <summary> /// 开始 /// </summary> public override bool Begin(SkillAction action) { base.Begin(action); // 播放持续施法结束的动画 if (mSkillAction.ActionData.CastingEndAnimation != string.Empty) { mSkillAction.SkillParent.SrcActor.Play(mSkillAction.ActionData.CastingEndAnimation); } // 还原技能动画 else if (mSkillAction.ActionData.CastingAnimation != string.Empty && mSkillAction.ActionData.CastingAnimation != mSkillAction.ActionData.SkillAnimation) { mSkillAction.SkillParent.SrcActor.Play(mSkillAction.ActionData.SkillAnimation); } mSkillAction.SkillParent.SrcActor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale); //mSkillAction.SkillParent.SrcActor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale); return(true); }
/// <summary> /// 开始 /// </summary> public override bool Begin(SkillAction action) { base.Begin(action); // 判定是否要进入吟唱阶段 if (action.ActionData.CastingReadyStageTime <= 0) { m_is_finish = true; return(false); } m_is_finish = false; if (mSkillAction.SkillParent.SrcActor != null && mSkillAction.SkillParent.SrcActor.IsLocalPlayer) { InstanceManager.Instance.SetInCastingReadyStage(true, action.ActionData.CastingReadyStageTime); } if (mSkillAction.ActionData.CastingReadyAnimation != string.Empty) { mSkillAction.SkillParent.SrcActor.Play(mSkillAction.ActionData.CastingReadyAnimation); } return(true); }
/// <summary> /// 开始 /// </summary> public override bool Begin(SkillAction action) { base.Begin(action); m_DynamicStageTime = mSkillAction.ActionData.CastingStageTime; m_RealTargetPos = Vector3.zero; // 判定是否要进入持续施法阶段 if (mSkillAction.ActionData.SkillInfo.CastingTime <= 0.0f) { return(false); } Actor src_actor = mSkillAction.SkillParent.SrcActor; // 技能的隐身 if (mSkillAction.ActionData.SkillInfo.Invisible) { if (src_actor.mVisibleCtrl.VisibleMode == EVisibleMode.Visible) { mSkillAction.HideActor = true; src_actor.mVisibleCtrl.SetActorVisible(false, true, false, VisiblePriority.SKILL); } } // 播放动画 string casting_ani = mSkillAction.ActionData.CastingAnimation; if (casting_ani != string.Empty && casting_ani != mSkillAction.ActionData.SkillAnimation) { src_actor.Play(mSkillAction.ActionData.CastingAnimation); } src_actor.SetAnimationSpeed(mSkillAction.SkillParent.SpeedScale); // 施法阶段的位移 MoveCtrl move_ctrl = src_actor.MoveCtrl; mSkillAction.SkillParent.MovingSpeed = mSkillAction.ActionData.SkillInfo.CastingSpeed; src_actor.MoveSpeed = mSkillAction.ActionData.SkillInfo.CastingSpeed; mSkillAction.BeginMove(); uint target_id = mSkillAction.SkillParent.TargetID; // 目标玩家的id if (target_id == 0) // 无目标玩家 { move_ctrl.MoveDirInAttacking(src_actor.ForwardDir); // 沿当前方向移动 Vector3 src_pos = src_actor.Trans.position; m_RealTargetPos = src_pos + mSkillAction.SkillParent.AttackDir * mSkillAction.ActionData.SkillInfo.CastingSpeed * mSkillAction.ActionData.CastingStageTime; XNavMeshHit hit; if (XNavMesh.Raycast(src_pos, m_RealTargetPos, out hit, xc.Dungeon.LevelManager.GetInstance().AreaExclude)) { m_RealTargetPos = PhysicsHelp.BoundaryHitPos(src_pos, hit.position); } } else// 有目标玩家 { Vector3 src_pos = src_actor.Trans.position; Actor target_actor = ActorManager.Instance.GetPlayer(target_id);// 获取目标玩家 Vector3 target_pos = Vector3.zero; if (target_actor != null) { target_pos = target_actor.Trans.position; Vector3 vec = target_pos - src_pos; float len = vec.magnitude; if (len > mSkillAction.RushTargetRange) { float real_len = len - mSkillAction.RushTargetRange; target_pos = src_pos + vec * real_len / len; XNavMeshHit hit; if (XNavMesh.Raycast(src_pos, target_pos, out hit, xc.Dungeon.LevelManager.GetInstance().AreaExclude)) { target_pos = PhysicsHelp.BoundaryHitPos(src_pos, hit.position); } if (mSkillAction.ActionData.SkillInfo.CastingSpeed != 0) { m_RealTargetPos = target_pos; float calc_castingTime = real_len / mSkillAction.ActionData.SkillInfo.CastingSpeed;// 根据距离和速度计算施法阶段的时间 float fix_castingTime = mSkillAction.ActionData.CastingStageTime; if (calc_castingTime < fix_castingTime) { m_DynamicStageTime = calc_castingTime; } } } else { target_pos = src_pos; m_DynamicStageTime = 0; } move_ctrl.MoveDirInAttacking(vec);// 冲到目标点的方向 } else { target_pos = src_pos + mSkillAction.SkillParent.AttackDir * mSkillAction.ActionData.SkillInfo.CastingSpeed * mSkillAction.ActionData.CastingStageTime; XNavMeshHit hit; if (XNavMesh.Raycast(src_pos, target_pos, out hit, xc.Dungeon.LevelManager.GetInstance().AreaExclude)) { target_pos = PhysicsHelp.BoundaryHitPos(src_pos, hit.position); m_RealTargetPos = target_pos; } } if (src_actor.AttackCtrl.mIsSendMsg) { C2SNwarChargeStop charge_stop = new C2SNwarChargeStop(); charge_stop.skill_id = mSkillAction.ActionData.SkillInfo.Id; PkgNwarMove move = new PkgNwarMove(); move.id = src_actor.UID.obj_idx; PkgNwarPos pos = new PkgNwarPos(); pos.px = (int)(target_pos.x * 100); pos.py = (int)(target_pos.z * 100); move.pos = pos; move.speed = 0; move.time = 0; charge_stop.move = move; NetClient.GetCrossClient().SendData <C2SNwarChargeStop>(NetMsg.MSG_NWAR_CHARGE_STOP, charge_stop); } } return(true); }
/// <summary> /// 结束 /// </summary> public virtual void End() { mStageTime = 0; mSkillAction = null; }
/// <summary> /// 开始 /// </summary> public virtual bool Begin(SkillAction action) { mSkillAction = action; mStageTime = 0; return(true); }
public override void Update() { base.Update(); bool attackResult = true; if (mTargetSkillId != mRunningProperty.TargetSkillId) { attackResult = mRunningProperty.AI.DoAttack(); mTargetSkillId = mRunningProperty.TargetSkillId; } if (TargetSkill != null && TargetSkill.IsMultiAction()) { mCurrentDeltaTime += Time.deltaTime; xc.SkillAction skillAction = TargetSkill.CurAction; if ((TargetSkill != null && TargetSkill.IsCanCacheNext() == true)) { mCurrentDeltaTime = 0.0f; //GameDebug.LogError("Update: " + TargetSkill.SkillID); attackResult = mRunningProperty.AI.DoAttack(); ++mCurrentComboAttackCount; } if (TargetSkill != null) { if (mCurrentComboAttackCount >= TargetSkill.GetSkillActionCount()) { if (mRunningProperty.SelfActor.IsAttacking() == false && mRunningProperty.SelfActor.IsWalking() == false) { mRunningProperty.AI.Machine.SwitchToState(BehaviourMachine.State.EMPTY); } if (TargetSkill != null && TargetSkill.IsCanCacheNext() == true) { mRunningProperty.TargetSkillId = 0; mTargetSkillId = 0; //mRunningProperty.AI.Machine.SwitchToState(BehaviourMachine.State.EMPTY); } mCurrentComboAttackCount = 0; } } } if (mRunningProperty.SelfActor.IsAttacking() == false && mRunningProperty.SelfActor.IsWalking() == false) { mRunningProperty.AI.Machine.SwitchToState(BehaviourMachine.State.EMPTY); } if (TargetSkill != null && TargetSkill.IsInBeforeSkillActionEndingStage() == false) { mRunningProperty.TargetSkillId = 0; mTargetSkillId = 0; //mRunningProperty.AI.Machine.SwitchToState(BehaviourMachine.State.EMPTY); } if (attackResult == false) { } //GameDebug.LogError("Update: " + mRunningProperty.TargetSkillId); }