private static CCrossSightLoic.Target GetTargetEntity(IContext context, LinkedList <CCrossSightLoic.Target> entities, BaseEntity ower, TargetSelectionData targetSelection) { if (entities == null) { return(null); } //阵营过滤 GameplayProxy gameplayProxy = GameFacade.Instance.RetrieveProxy(ProxyName.GameplayProxy) as GameplayProxy; LinkedList <CCrossSightLoic.Target> nLinkedList = new LinkedList <CCrossSightLoic.Target>(); LinkedListNode <CCrossSightLoic.Target> pVertor = entities.First; CCrossSightLoic.Target pb = null; while (pVertor != null) { pb = pVertor.Value; pVertor = pVertor.Next; BaseEntity entity2 = GameplayManager.Instance.GetEntityManager().GetEntityById <BaseEntity>((uint)pb.target_entityId); if (entity2 == null) { continue; } bool same = gameplayProxy.IsBelongToThisFactionType(targetSelection.FactionType, ower, entity2); if (same) { nLinkedList.AddLast(pb); } } //目标选择 PerceptronTarget perceptron = context.GetObject <PerceptronTarget>(); IBaseActionProperty baseActionProperty = context.GetObject <IBaseActionProperty>(); CCrossSightLoic.Target result = null; if (targetSelection.Target == TargetType.Target) //表示当前选中的目标(实体,点) { result = nLinkedList.First?.Value; } else if (targetSelection.Target == TargetType.TargetNext) ///选中当前的目标,下次选择选中下一个目标 { result = nLinkedList.First?.Value; perceptron.RetropositionEntity(nLinkedList.First?.Value); } else if (targetSelection.Target == TargetType.Self) /// 1.选择自己 2.如果是飞行物的话 自己表示的飞行物本身 { result = new CCrossSightLoic.Target(); result.target_entityId = baseActionProperty.GetOwner().EntityId(); result.target_pos = baseActionProperty.GetOwner().GetRootTransform().position; } else if (targetSelection.Target == TargetType.Owner) /// 1.选择自己的owner(或者说是caster) 2.如果是飞行物的话还是技能的caster { BaseEntity fentity = GameplayManager.Instance.GetEntityManager().GetEntityById <BaseEntity>(baseActionProperty.GetEntityFatherOwnerID()); if (fentity != null) { result = new CCrossSightLoic.Target(); result.target_entityId = baseActionProperty.GetEntityFatherOwnerID(); result.target_pos = fentity.GetRootTransform().position; } } return(result); }