new CostTable()
Creates a new cost table.
Methods
-
clear() → {CostTable}
-
Clears the cost table.
-
fromJSON(json) → {CostTable}
-
Restores this instance from the given JSON object.
Parameters:
Name Type Description json
Object The JSON object.
-
get(from, to) → {Number}
-
Returns the cost for the given pair of navigation nodes.
Parameters:
Name Type Description from
Number The start node index.
to
Number The destintation node index.
Returns:
Number -The cost.
-
init(navMesh) → {CostTable}
-
Inits the cost table for the given navigation mesh.
Parameters:
Name Type Description navMesh
NavMesh The navigation mesh.
-
set(from, to, cost) → {CostTable}
-
Sets the cost for the given pair of navigation nodes.
Parameters:
Name Type Description from
Number The start node index.
to
Number The destintation node index.
cost
Number The cost.
-
size() → {Number}
-
Returns the size of the cost table (amount of entries).
Returns:
Number -The size of the cost table.
-
toJSON() → {Object}
-
Transforms this instance into a JSON object.
Returns:
Object -The JSON object.