/// <summary> /// 根据技能id,获取到受击者的列表 /// 返回值 是一个三元组。分别是 dummy list, monster list, player list /// </summary> /// <param name="hitActionID"></param> /// <param name="ltwm"></param> /// <param name="rotation"></param> /// <param name="forward"></param> /// <param name="position"></param> /// <returns></returns> private List <List <uint> > GetHitEntities(int hitActionID, Matrix4x4 ltwm, Quaternion rotation, Vector3 forward, Vector3 position) { var spellData = SkillAction.dataMap[hitActionID]; //技能实施的目标类型,0敌人,1自己,2队友,3友方 int targetType = spellData.targetType; //技能范围类型。0 扇形 1 圆形 2单体 3直线 4前方 int targetRangeType = spellData.targetRangeType; //攻击范围参数。 针对不同类型,有不同的意义。 浮点数列表 List <float> targetRangeParam = spellData.targetRangeParam; float offsetX = spellData.hitXoffset; float offsetY = spellData.hitYoffset; float angleOffset = 180; List <List <uint> > entities = new List <List <uint> >(); if (targetType == (int)TargetType.Myself) { List <uint> listDummy = new List <uint>(); List <uint> listMonster = new List <uint>(); List <uint> listPlayer = new List <uint>(); List <uint> listMercenary = new List <uint>(); listPlayer.Add(theOwner.ID); entities.Add(listDummy); entities.Add(listMonster); entities.Add(listPlayer); entities.Add(listMercenary); return(entities); } if (theOwner.Transform == null) { return(entities); } Matrix4x4 entityltwm = theOwner.Transform.localToWorldMatrix; Quaternion entityrotation = theOwner.Transform.rotation; Vector3 entityforward = theOwner.Transform.forward; Vector3 entityposition = theOwner.Transform.position; //如果技能释放的位置不是自身,当castPosType为0的时候,不是自身 if (spellData.castPosType == 0) { entityltwm = ltwm; entityrotation = rotation; entityforward = forward; entityposition = position; } TargetRangeType rangeType = (TargetRangeType)targetRangeType; switch (rangeType) { //圆形 case TargetRangeType.CircleRange: if (targetRangeParam.Count >= 1) { float radius = targetRangeParam[0] * 0.01f; //参数1为范围半径 if (spellData.castPosType == 2 && theOwner is EntityDummy) { EntityParent e = theOwner.GetTargetEntity(); if (e != null) { entities = UnityTools.GetEntityInRange(e.Transform.position, radius, offsetX, offsetY, angleOffset); } } else { entities = UnityTools.GetEntityInRange(entityltwm, entityrotation, entityforward, entityposition, radius, offsetX, offsetY, angleOffset); } } break; //直线 case TargetRangeType.LineRange: if (targetRangeParam.Count >= 2) { float length = targetRangeParam[0] * 0.01f; float width = targetRangeParam[1] * 0.01f; entities = UnityTools.GetEnitiesForntLineNew(entityltwm, entityrotation, entityforward, entityposition, length, entityforward, width, offsetX, offsetY, angleOffset); } break; } return(entities); }