Class Land.Portal
raft.kilavuz.runtime.Land.Portal All Implemented Interfaces:
-
Enclosing class:
-
public class Land.Portal
line of (generally) border cells which leads to same sector with same action.
Field Summary |
|
actionaction required to pass through this portal. |
|
|
|
DISABLEDconstant to indicate portal is disabled |
|
ENABLEDconstant to indicate portal is enabled |
|
|
|
|
Method Summary |
|
fromNode()returns the node this transition originates from |
|
getAction()returns the action required to pass through this portal |
|
getCenter()returns center point of this portal |
|
|
|
|
|
getLand()returns enclosing land instance |
|
|
|
isEnabled()returns enabled status of this portal |
|
setEnabled(boolean enabled)set enabled status of this portal. |
|
|
|
|
|
toNode()returns the node this transition leads to |
|
toString()returns string representation of this portal |
Field Detail
ENABLED
public static final boolean ENABLED
-
constant to indicate portal is enabled
DISABLED
public static final boolean DISABLED
-
constant to indicate portal is disabled
id
public final int id
-
id of this portal. same with the corresponding portal in Grid
regular
public final boolean regular
-
if this portal is regular.
a regular portal is a portal which is created during flood fill
and leads to an adjacent sector
direction
-
orientation of this portal. null for non regular portals
action
public final short action
-
action required to pass through this portal.
Land.ACTION_NONE for regular portals which can be passed by simple movement.
See Also:
-
Method Detail
getAction
public short getAction()
-
returns the action required to pass through this portal
-
See Also:
-
setEnabled
public void setEnabled(boolean enabled)
-
set enabled status of this portal.
a portal is enabled by default. it may be disabled for special purposes
isEnabled
public boolean isEnabled()
-
returns enabled status of this portal
fromNode
-
returns the node this transition originates from
Specified by:
-
toNode
-
returns the node this transition leads to
Specified by:
-
getCost
-
returns cost for passing through this portal. precedence is as follows:
- if this portal is not enabled INFINITE_COST is returned
- if an explicit cost is set, it is returned
- if this is a regular portal and unit size in context is
more than this portal's length INFINITE_COST is returned
- otherwise euclidian distance (in grid space) betweens centers of owner and destination
is returned.
note, specifiying a unit size more than 1 may lead to undesirable side effects
especially in enviroments with lots of small sectors/portals.
instead of specifying unitSize create different lands for with different unit sizes.
see the tutorial for a discussion.
Specified by:
-
Parameters:
-
context - more information about pathfinding enviroment.
-
See Also:
-
setUserObject
public void setUserObject(Object userObject) -
sets user defined object.
use when you want to store additional information about this portal.
note given object is also serialized when Land is serialized
Parameters:
-
userObject - user object, null to clear user object
-
See Also:
-
getUserObject
-
returns user defined object
-
See Also:
-
getLand
-
returns enclosing land instance
getCenter
-
returns center point of this portal
setExplicitCost
public void setExplicitCost(Float cost) -
explicitly sets cost of passing through this portal.
if an explicit cost is set, it has precedence over regular cost calculation.
setting to null removes explicit cost information. explicit cost set on Grid.Portal
is transferred to Land.Portal when the land is created
getExplicitCost
public Float getExplicitCost() -
returns explicit cost or null if not set
toString
-
returns string representation of this portal
Overrides:
-
DocFlex/Doclet is both a multi-format Javadoc doclet and a free edition of DocFlex/Javadoc. If you need to customize your Javadoc without writing a full-blown doclet from scratch, DocFlex/Javadoc may be the only tool able to help you! Find out more at www.docflex.com