local FuncNode_DistanceLess = class("FuncNode_DistanceLess") --[[ 初始化 --]] function FuncNode_DistanceLess:initialize(entity) self.LimitChildCount = 3 self.Type = LuaConst.ConditionFuncType.DistanceLess end --[[ 执行 --]] function FuncNode_DistanceLess:Run(conditionDataNode, entity, missile) local startType = conditionDataNode.FirstNode:Run(entity, missile) local endType = conditionDataNode.SecondNode:Run(entity, missile) local limitDistSqr = conditionDataNode.ThirdNode:Run(entity, missile) local distance = FP.Const.Zero --到目标的距离 if startType == FP.Const.Zero and endType == FP.Const.One or startType == FP.Const.One and endType == FP.Const.Zero then distance = entity.components.target.ToTargetDisSqr end --到群组领袖的距离 if startType == FP.Const.Zero and endType == FP.Const.Four or startType == FP.Const.Four and endType == FP.Const.Zero then distance = entity.components.group.ToLeaderDisSqr end --到跟随目标的距离 if startType == FP.Const.Zero and endType == FP.Const.Six or startType == FP.Const.Six and endType == FP.Const.Zero then distance = entity.components.target.ToFollowTargetDisSqr end --到主人的距离 if startType == FP.Const.Zero and endType == FP.Const.Seven then if entity:GetMasterEntity() then distance = FP.newV1(0) entity:GetLogicPos():DistanceSqr(entity:GetMasterEntity():GetLogicPos(), distance) end end return distance < limitDistSqr and FP.Const.One or FP.Const.Zero end return FuncNode_DistanceLess