Drag[en]gine Script Module DragonScript Script API  1.0
FindClosestVisitor Class Reference
Inheritance diagram for FindClosestVisitor:
ElementVisitor

Public Member Functions

void clearClosest ()
 
float getClosestDistance ()
 
Element getClosestElement ()
 
void keepIfCloser (Element element)
 
FindClosestVisitor new (DVector origin)
 
void setIfCloser (Element element)
 
void visitElement (Element element)
 
- Public Member Functions inherited from ElementVisitor
ElementVisitor new ()
 
void visitElement (Element element)
 
void visitLight (BaseLight light)
 
void visitLightPoint (LightPoint light)
 
void visitLightSpot (LightSpot light)
 
void visitSimpleElement (SimpleElement element)
 
void visitTrigger (Trigger trigger)
 
void visitTriggerArea (TriggerArea trigger)
 
void visitTriggerCounter (TriggerCounter trigger)
 
void visitTriggerShout (TriggerShout trigger)
 
void visitTriggerTarget (TriggerTarget trigger)
 

Detailed Description

Finds the closest element to a given position.

Author
Roland Pl├╝ss
Version
1.0

Member Function Documentation

§ clearClosest()

void clearClosest ( )

Clears the closest element.

§ getClosestDistance()

float getClosestDistance ( )

Retrieves the distance of the closest element or 0 otherwise.

Returns
distance of closest element or 0

§ getClosestElement()

Element getClosestElement ( )

Retrieves the closest element if found or null otherwise.

Returns
closest element or null

§ keepIfCloser()

void keepIfCloser ( Element  element)

Store element if the distance of the center to the origin is less than the already found closest element.

Parameters
elementElement to check

§ new()

FindClosestVisitor new ( DVector  origin)

Creates a new FindClosestVisitor.

Parameters
originPosition to measure distancefrom

§ setIfCloser()

void setIfCloser ( Element  element)

Store element if the distance of the center to the origin is less than the already found closest element.

Parameters
elementElement to check

§ visitElement()

void visitElement ( Element  element)

Visit an element. Store it as closest element if the distance of the center of it to the origin is less than the already found closest element or if the element is null.

Parameters
elementVisited element

The documentation for this class was generated from the following file: