A rule value that changes how the Grid.getNeighbors method decides which nodes are neighbors.
For example:
Given a boolean grid and a centerNode
at (1, 1):
0 1 2
-------------------------
0 | true | true | true |
|-------|-------|-------|
1 | false | true | true |
|-------|-------|-------|
2 | true | false | false |
-------------------------
An obstruction is any Node node
where node.walkable == false
, and that node
is inbetween the centerNode
and one of its corner neighbors.
So, of of the walkable corner neighbors of centerNode
, each has these obstructions:
Top Right (2, 0): 0 obstructions ->
Top Left (0, 0): 1 obstructions -> (0, 1)
Bot Left (0, 2): 2 obstructions -> (0, 1) (1, 2)
For the different values of DiagonalMovement, the results of Grid.getNeighbors(centerNode) are:
case DiagonalMovement.Always:
[(0, 0), (1, 0), (2, 0), (2, 1), (0, 2)]
case DiagonalMovement.Never:
[(1, 0), (2, 1)]
case DiagonalMovement.WithNoObstructions:
[(2, 0), (1, 0), (2, 1)]
case DiagonalMovement.WithOneObstruction:
[(0, 0), (2, 0), (1, 0), (2, 1)]
Constants
- Always → DiagonalMovement
-
const
const DiagonalMovement(1)
- Never → DiagonalMovement
-
const
const DiagonalMovement(2)
- values → List<DiagonalMovement>
-
A constant List of the values in this enum, in order of their declaration.
constconst List<DiagonalMovement>
- WithNoObstructions → DiagonalMovement
-
const
const DiagonalMovement(3)
- WithOneObstruction → DiagonalMovement
-
const
const DiagonalMovement(4)
Properties
- hashCode → int
-
Get a hash code for this object.…
read-only, inherited - index → int
-
read-only
- runtimeType → Type
-
A representation of the runtime type of the object.
read-only, inherited
Operators
-
operator ==(
other) → bool -
The equality operator.…
inherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
noSuchMethod
is invoked when users invoke a non-existent method on an object. The name of the method and the arguments of the invocation are passed tonoSuchMethod
in anInvocation
. IfnoSuchMethod
returns a value, that value becomes the result of the original invocation.…inherited -
toString(
) → String -
Returns a string representation of this object.
inherited