local FuncNode_DistanceBuffSource = class("FuncNode_DistanceBuffSource") --[[ 初始化 --]] function FuncNode_DistanceBuffSource:initialize(entity) self.LimitChildCount = 0 self.Type = LuaConst.ConditionFuncType.DistanceBuffSource end --[[ 执行 --]] function FuncNode_DistanceBuffSource:Run(conditionDataNode, entity, missile, buffObject) local lastUpdateData = buffObject:GetLastUpdateData() if lastUpdateData == nil then -- buff不存在,返回无穷远 return FP.Const.Max end local buffSourceEntity = lastUpdateData.SourceEntity -- 无buff来源 或者 自己给自己加的buff ,则距离为0 if (not buffSourceEntity) or entity == buffSourceEntity then return FP.Const.Zero end --到目标的距离 local disSqr = FP.V2.DistanceSqr(buffSourceEntity:GetLogicPos(), entity:GetLogicPos()) return disSqr end return FuncNode_DistanceBuffSource