コード例 #1
0
ファイル: Faction.cs プロジェクト: PepeBiondi/runsa
		public static bool IsNearType( Mobile mob, Type[] types, int range )
		{
			IPooledEnumerable eable = mob.GetObjectsInRange( range );

			foreach( object obj in eable )
			{
				Type objType = obj.GetType();

				for( int i = 0; i < types.Length; i++ )
				{
					if( types[i].IsAssignableFrom( objType ) )
					{
						eable.Free();
						return true;
					}
				}
			}

			eable.Free();
			return false;
		}
コード例 #2
0
ファイル: Faction.cs プロジェクト: ITLongwell/aedilis2server
		public static bool IsNearType( Mobile mob, Type[] types, int range )
		{
			/*
			bool mobs = type.IsSubclassOf( typeof( Mobile ) );
			bool items = type.IsSubclassOf( typeof( Item ) );

			IPooledEnumerable eable;

			if( mobs )
				eable = mob.GetMobilesInRange( range );
			else if( items )
				eable = mob.GetItemsInRange( range );
			else
				return false;
			 * */

			IPooledEnumerable eable = mob.GetObjectsInRange( range );

			foreach( object obj in eable )
			{
				Type objType = obj.GetType();

				for( int i = 0; i < types.Length; i++ )
				{
					if( types[i].IsAssignableFrom( objType ) )
					{
						eable.Free();
						return true;
					}
				}
			}

			eable.Free();
			return false;
		}