本文整理汇总了C#中Object.OnRangeUpdate方法的典型用法代码示例。如果您正苦于以下问题:C# Object.OnRangeUpdate方法的具体用法?C# Object.OnRangeUpdate怎么用?C# Object.OnRangeUpdate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Object
的用法示例。
在下文中一共展示了Object.OnRangeUpdate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateRange
public bool UpdateRange(Object CurObj, bool ForceUpdate = false)
{
if (CurObj.IsActive == false || CurObj.IsDisposed)
return false;
if (CurObj.X == 0 && CurObj.Y == 0)
return false;
float Distance = CurObj.GetDistance(CurObj.LastRangeCheck);
if (Distance > 100 || ForceUpdate)
{
CurObj.LastRangeCheck.X = CurObj.X;
CurObj.LastRangeCheck.Y = CurObj.Y;
}
else
return false;
CurObj.OnRangeUpdate();
GetRangedObject(CurObj, 1, (Object DistObj) =>
{
if (DistObj == null)
return;
if (IsVisibleBForA(CurObj, DistObj) && !CurObj.HasInRange(DistObj))
{
CurObj.AddInRange(DistObj);
DistObj.AddInRange(CurObj);
if (CurObj.IsPlayer())
DistObj.SendMeTo(CurObj.GetPlayer());
if (DistObj.IsPlayer())
CurObj.SendMeTo(DistObj.GetPlayer());
}
});
Object dist;
for (int i = 0; i < CurObj._ObjectRanged.Count; ++i)
{
if ((dist = CurObj._ObjectRanged[i]) == null)
continue;
if (CurObj == null || dist == null)
continue;
if (dist.GetDistance(CurObj) > MAX_VISIBILITY_RANGE || !IsVisibleBForA(CurObj, dist))
{
CurObj.RemoveInRange(dist);
dist.RemoveInRange(CurObj);
i--;
}
}
return true;
}