Exemplo n.º 1
0
        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);
             * }*/
        }
Exemplo n.º 2
0
 public void Exit(EntityParent theOwner, params object[] args)
 {
 }
Exemplo n.º 3
0
 public void Enter(EntityParent theOwner, params object[] args)
 {
     theOwner.CurrentMotionState = MotionState.ATTACKING;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 返回技能加成伤害
 /// </summary>
 /// <param name="skillData"></param>
 /// <param name="attacker"></param>
 /// <param name="victimer"></param>
 /// <returns></returns>
 public static double CacuAddDamage(SkillAction skillData, EntityParent attacker, EntityParent victimer)
 {
     if (skillData.damageAddType == (byte)damageAddType.AD)
     {
         var atk = GetProperty(attacker, "Attack");
         return(skillData.damageAdd * atk);
     }
     else if (skillData.damageAddType == (byte)damageAddType.AP)
     {
         var ap = GetProperty(attacker, "AbilityPower");
         return(skillData.damageAdd * ap);
     }
     else if (skillData.damageAddType == (byte)damageAddType.AR)
     {
         var ar = GetProperty(attacker, "Armor");
         return(skillData.damageAdd * ar);
     }
     else if (skillData.damageAddType == (byte)damageAddType.MyselfHP)
     {
         var hp = GetProperty(attacker, "HP");
         return(skillData.damageAdd * hp);
     }
     else if (skillData.damageAddType == (byte)damageAddType.OhterHP)
     {
         if (null == victimer)
         {
             var hp = GetProperty(attacker, "HP");
             return(skillData.damageAdd * hp);
         }
         else
         {
             var hp = GetProperty(victimer, "HP");
             return(skillData.damageAdd * hp);
         }
     }
     return(0);
 }
Exemplo n.º 5
0
        /// <summary>
        /// 取得实体的暴击率
        /// </summary>
        /// <param name="attacker">攻击者</param>
        /// <returns></returns>
        public static double GetCritRate(EntityParent attacker)
        {
            var crit = GetProperty(attacker, "critRate");

            return(crit);
        }
Exemplo n.º 6
0
 /// <summary>
 /// 实体进入到游戏世界中
 /// </summary>
 /// <param name="entity"></param>
 public static void OnEnterWorld(EntityParent entity)
 {
     //主要是处理缓存实体到字典中
 }