GameFramework.AiLogicUtility.StepCalcNearstTarget C# (CSharp) Method

StepCalcNearstTarget() private static method

private static StepCalcNearstTarget ( EntityInfo srcObj, CharacterRelation relation, AiTargetType type, float powDist, EntityInfo obj, float &minPowDist, EntityInfo &nearstTarget ) : void
srcObj EntityInfo
relation CharacterRelation
type AiTargetType
powDist float
obj EntityInfo
minPowDist float
nearstTarget EntityInfo
return void
        private static void StepCalcNearstTarget(EntityInfo srcObj, CharacterRelation relation, AiTargetType type, float powDist, EntityInfo obj, ref float minPowDist, ref EntityInfo nearstTarget)
        {
            EntityInfo target = GetSeeingLivingCharacterInfoHelper(srcObj, obj.GetId());
            if (null != target && !target.IsDead()) {
                if (!target.IsTargetNpc()) {
                    return;
                }
                if (type == AiTargetType.HERO && target.EntityType != (int)EntityTypeEnum.Hero) {
                    return;
                }
                if (type == AiTargetType.TOWER && target.EntityType != (int)EntityTypeEnum.Tower) {
                    return;
                }
                if (type == AiTargetType.BOSS && target.EntityType != (int)EntityTypeEnum.Boss) {
                    return;
                }
                if (type == AiTargetType.NPC && target.EntityType != (int)EntityTypeEnum.Normal) {
                    return;
                }
                if (relation == EntityInfo.GetRelation(srcObj, target)) {
                    if (powDist < minPowDist) {
                        if (powDist > c_MaxViewRangeSqr || CanSee(srcObj, target)) {
                            nearstTarget = target;
                            minPowDist = powDist;
                        }
                    }
                }
            }
        }