Packagebe.dauntless.astar.basic3d
Classpublic class Map3D
InheritanceMap3D Inheritance Object
Implements IMap
Subclasses GravityMap3D

A simple Map implementation for the IMap interface



Public Properties
 PropertyDefined By
  standardCost : Number
Gets the standard cost for this map
Map3D
Public Methods
 MethodDefined By
  
Map3D(width:int, length:int, height:int, defaultCost:int = 1)
Creates a new Map object with the specified width en height
Map3D
  
Returns the distance multiplier for the given two tiles.
Map3D
  
Map3D
  
Returns a list with the neighbours of the given tile.
Map3D
  
getTileAt(position:Point):IPositionTile
Returns the IPositionTile at the given location
Map3D
  
Sets the given tile at the given location
Map3D
Protected Methods
 MethodDefined By
  
isValidPosition(position:Point):Boolean
Returns whether or not the given position is located within the map
Map3D
Property Detail
standardCostproperty
standardCost:Number

Gets the standard cost for this map


Implementation
    public function get standardCost():Number
    public function set standardCost(value:Number):void
Constructor Detail
Map3D()Constructor
public function Map3D(width:int, length:int, height:int, defaultCost:int = 1)

Creates a new Map object with the specified width en height

Parameters
width:int — The width of the map
 
length:int — The height of the map
 
height:int
 
defaultCost:int (default = 1)
Method Detail
getDistance()method
public function getDistance(f:IAstarTile, t:IAstarTile):Number

Returns the distance multiplier for the given two tiles. It can return the following: SQRT(2) - If the tiles have only one axis in common SQRT(3) - If the tiles have no axis in common 1 - If the tiles have two axis in common

Parameters

f:IAstarTile — The first point
 
t:IAstarTile — The second point

Returns
Number — The multiplier to be used for setting the correct cost to go from the first tile to the second
getHeuristic()method 
public function getHeuristic(tile:IAstarTile, req:PathRequest):Number

Parameters

tile:IAstarTile
 
req:PathRequest

Returns
Number
getNeighbours()method 
public function getNeighbours(tile:IAstarTile):Vector.<IAstarTile>

Returns a list with the neighbours of the given tile.

Parameters

tile:IAstarTile — The position of the tile to get the neighbours of

Returns
Vector.<IAstarTile> — A list containing all the neighbouring tiles
getTileAt()method 
public function getTileAt(position:Point):IPositionTile

Returns the IPositionTile at the given location

Parameters

position:Point — The point specifing the location for the tile

Returns
IPositionTile — IPositionTile at the given location
isValidPosition()method 
protected function isValidPosition(position:Point):Boolean

Returns whether or not the given position is located within the map

Parameters

position:Point — The position to check

Returns
Boolean — A boolean indicating if the given position is located within the map
setTile()method 
public function setTile(tile:IPositionTile):void

Sets the given tile at the given location

Parameters

tile:IPositionTile — The tile to place in the map