Axiom.Core.DefaultSphereRegionSceneQuery.Execute C# (CSharp) Method

Execute() public method

public Execute ( ISceneQueryListener listener ) : void
listener ISceneQueryListener
return void
		public override void Execute( ISceneQueryListener listener )
		{
			Sphere testSphere = new Sphere();

			MovableObjectFactoryMap factories = Root.Instance.MovableObjectFactories;
			foreach ( KeyValuePair<string, MovableObjectFactory> map in factories )
			{
				MovableObjectCollection movableObjects = this.creator.GetMovableObjectCollection( map.Value.Type );
				foreach ( MovableObject movableObject in movableObjects.Values )
				{
					// skip group if query type doesn't match
					if ( ( this.QueryTypeMask & movableObject.TypeFlags ) == 0 )
					{
						break;
					}

					// skip if unattached or filtered out by query flags
					if ( !movableObject.IsAttached || ( movableObject.QueryFlags & this.queryMask ) == 0 )
					{
						continue;
					}

					testSphere.Center = movableObject.ParentNode.DerivedPosition;
					testSphere.Radius = movableObject.BoundingRadius;

					// if the results came back positive, fire the event handler
					if ( this.sphere.Intersects( testSphere ) )
					{
						listener.OnQueryResult( movableObject );
					}
				}
			}
		}
	}
DefaultSphereRegionSceneQuery