public void Process(EntityParent theOwner, params object[] args) { if (args.Length != 1) { Debug.LogError("没有攻击技能"); return; } int spellId = (int)args[0]; SkillData s = SkillData.dataMap[spellId]; theOwner.motor.speed = 0; theOwner.motor.targetSpeed = 0; int baseTime = 0; for (int i = 0; i < s.skillAction.Count; i++) { SkillAction action = SkillAction.dataMap[s.skillAction[0]]; List <object> args1 = new List <object>(); args1.Add(s.skillAction[0]); args1.Add(theOwner.Transform.localToWorldMatrix); args1.Add(theOwner.Transform.rotation); args1.Add(theOwner.Transform.forward); args1.Add(theOwner.Transform.position); //播放技能的第一个动作 if (i == 0) { ProcessHit(theOwner, spellId, args1); if (theOwner is EntityMyself) { theOwner.motor.enableStick = action.enableStick > 0; } } //如果没有后续动作了就跳出循环 if (i + 1 == s.skillAction.Count) { break; } //记录加到定时器里面的hit动作 uint tid = 0; List <object> args2 = new List <object>(); args2.Add(s.skillAction[i + 1]); args2.Add(theOwner.Transform.localToWorldMatrix); args2.Add(theOwner.Transform.rotation); args2.Add(theOwner.Transform.forward); args2.Add(theOwner.Transform.position); if (action.actionTime > 0) { tid = TimerHeap.AddTimer((uint)((baseTime + action.actionTime) / theOwner.aiRate), 0, ProcessHit, theOwner, spellId, args2); baseTime += action.actionTime; } if (action.nextHitTime > 0) { tid = TimerHeap.AddTimer((uint)((baseTime + action.nextHitTime) / theOwner.aiRate), 0, ProcessHit, theOwner, spellId, args2); baseTime += action.nextHitTime; } theOwner.hitTimer.Add(tid); } /*int actionID = (int)args[0]; * SkillActionData action = SkillActionData.dataMap[actionID]; * SkillData skill = SkillData.dataMap[theOwner.currSpellID]; * int duration = action.duration; * if (duration <= 0 && skill.skillAction.Count > 1 && theOwner.hitActionIdx >= (skill.skillAction.Count - 1)) * { * if (SkillActionData.dataMap[skill.skillAction[0]].duration <= 0) * { * //攻击结束,进入idle状态 * theOwner.AddCallbackInFrames<EntityParent>((_theOwner) => * { * * },theOwner); * } * } * else if (duration > 0 && action.action > 0) * { * TimerHeap.AddTimer<int, EntityParent>((uint)duration, 0, (_actionID,_theOwner) => * { * GameMotor theMotor = _theOwner.motor; * if (_theOwner.Transform) * { * theMotor.enableStick = true;//驱动设置为静止 * theMotor.SetExtraSpeed(0);//额外速度为0 * theMotor.SetMoveDirection(Vector3.zero);//移动方向为(0,0,0) * } * _theOwner.ChangeMotionState(MotionState.IDLE);//改变状态为idle * },actionID,theOwner); * } * if (action.duration > 0) * { * TimerHeap.AddTimer<int, EntityParent>((uint)action.duration, 0, (_actionID, _theOwner) => * { * * },actionID,theOwner); * }*/ }
public void UpdateData(SkillData skill, bool flag = true) { skillData = skill; showFlag = flag; }