当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.GetNPCsInRadius方法代码示例

本文整理汇总了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;
				}
				
//.........这里部分代码省略.........
开发者ID:mynew4,项目名称:DAoC,代码行数:101,代码来源:LosCheckMgr.cs


注:本文中的DOL.GS.GameObject.GetNPCsInRadius方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。