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 ()
 Create element visitor. More...
 
void visitBaseLight (BaseLight light)
 Visit base light. More...
 
void visitElement (Element element)
 Visit element. More...
 
void visitSimpleElement (SimpleElement element)
 Visit simple element. More...
 
void visitTrigger (Trigger trigger)
 Visit trigger. More...
 
void visitTriggerShout (TriggerShout trigger)
 Visit shout trigger. More...
 

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: