本文整理汇总了C#中DOL.GS.GameObject.GetNPCsInRadius方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.GetNPCsInRadius方法的具体用法?C# GameObject.GetNPCsInRadius怎么用?C# GameObject.GetNPCsInRadius使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DOL.GS.GameObject
的用法示例。
在下文中一共展示了GameObject.GetNPCsInRadius方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateVincinityLosCache
/// <summary>
/// Update nearest object with LoS results
/// </summary>
/// <param name="source">source of LoS</param>
/// <param name="target">target of Los</param>
/// <param name="losOK">is LoS ok ?</param>
/// <param name="time">current time</param>
private void UpdateVincinityLosCache(GameObject source, GameObject target, bool losOK, long time)
{
// Take NPCs in the largest Radius, should be EvE
foreach(GameNPC contamined in source.GetNPCsInRadius((ushort)LOSMGR_MAX_CONTAMINATION_RADIUS))
{
if(contamined == source || contamined == target)
continue;
// don't give LoS results to Peace NPC
if((contamined.Flags & GameNPC.eFlags.PEACE) == GameNPC.eFlags.PEACE)
continue;
// player pet to player should use the special PET radius
if((isObjectFromPlayer(target) || isObjectFromPlayer(source)) && isObjectFromPlayer(contamined))
{
// Update using PvP cache Timeout
if(LOSMGR_PET_CONTAMINATION_RADIUS > 0 && source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR) <= LOSMGR_PET_CONTAMINATION_RADIUS)
{
// FIXME debug
if(LOSMGR_DEBUG_LEVEL >= LOSMGR_DEBUG_DEBUG)
log.Warn("LOSMGR_D : Contamination Los Check (Pet PvP) of "+source.Name+" and "+target.Name+" Contaminated "+contamined.Name+", range : "+source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR));
UpdateLosCacheItem(source, target, losOK, LOSMGR_PLAYER_VS_PLAYER_CACHE_TIMEOUT, time);
}
continue;
}
// guard to anything should use guard radius
if(contamined is GameKeepGuard)
{
// Update using PvE cache Timeout
if(LOSMGR_GUARD_CONTAMINATION_RADIUS > 0 && source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR) <= LOSMGR_GUARD_CONTAMINATION_RADIUS)
{
// FIXME debug
if(LOSMGR_DEBUG_LEVEL >= LOSMGR_DEBUG_DEBUG)
log.Warn("LOSMGR_D : Contamination Los Check (Grd PvE) of "+source.Name+" and "+target.Name+" Contaminated "+contamined.Name+", range : "+source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR));
UpdateLosCacheItem(source, target, losOK, LOSMGR_PLAYER_VS_ENVIRONMENT_CACHE_TIMEOUT, time);
}
continue;
}
// if this NPC is targetting a player it's PvE, or I'm a pet not targeting a player it's PvE too
if((isObjectFromPlayer(target) || isObjectFromPlayer(source)) || isObjectFromPlayer(contamined))
{
// Update using PvE cache Timeout
if(LOSMGR_NPC_CONTAMINATION_RADIUS > 0 && source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR) <= LOSMGR_NPC_CONTAMINATION_RADIUS)
{
// FIXME debug
if(LOSMGR_DEBUG_LEVEL >= LOSMGR_DEBUG_DEBUG)
log.Warn("LOSMGR_D : Contamination Los Check (Mob PvE) of "+source.Name+" and "+target.Name+" Contaminated "+contamined.Name+", range : "+source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR));
UpdateLosCacheItem(source, target, losOK, LOSMGR_PLAYER_VS_ENVIRONMENT_CACHE_TIMEOUT, time);
}
continue;
}
// else it's EvE radius
if(source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR) <= LOSMGR_MAX_CONTAMINATION_RADIUS)
{
// FIXME debug
if(LOSMGR_DEBUG_LEVEL >= LOSMGR_DEBUG_DEBUG)
log.Warn("LOSMGR_D : Contamination Los Check (Mob EvE) of "+source.Name+" and "+target.Name+" Contaminated "+contamined.Name+", range : "+source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR));
UpdateLosCacheItem(source, target, losOK, LOSMGR_ENVIRONMENT_VS_ENVIRONMENT_CACHE_TIMEOUT, time);
}
}
// Take Player in the largest Radius, should be PvE for players
foreach(GamePlayer contamined in source.GetPlayersInRadius((ushort)LOSMGR_NPC_CONTAMINATION_RADIUS))
{
if(contamined == source || contamined == target)
continue;
// P v P
if(target is GamePlayer || source is GamePlayer)
{
if(LOSMGR_PLAYER_CONTAMINATION_RADIUS > 0 && source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR) <= LOSMGR_PLAYER_CONTAMINATION_RADIUS)
{
// FIXME debug
if(LOSMGR_DEBUG_LEVEL >= LOSMGR_DEBUG_DEBUG)
log.Warn("LOSMGR_D : Contamination Los Check (Pl PvP) of "+source.Name+" and "+target.Name+" Contaminated "+contamined.Name+", range : "+source.GetDistanceTo(contamined, LOSMGR_CONTAMINATION_ZFACTOR));
UpdateLosCacheItem(source, target, losOK, LOSMGR_PLAYER_VS_PLAYER_CACHE_TIMEOUT, time);
}
continue;
}
//.........这里部分代码省略.........