CheckIfValidNode() will be called by the
MapNavBase.NodesAround() (or override in MapNavHexa or MapNavSquare depending on which you use) when it needs to know something about a tile.
NodesAround will pass a parameter, the tile it is currently looking at, to
CheckIfValidNode when it makes the call.
MapNavHexa .cs you will see this for example where
callback is the
CheckIfValidNode method that was passed to
public override List<T> NodesAround<T>(MapNavNode node, bool includeInvalid, bool includeCentralNode, ValidationCallback callback)
if (callback != null)
if (false == node.isValid || false == callback(node))
CheckIfValidNode should simply return true or false to indicate whether a tile is consifered “valid” for the use case. You can have various
CheckIfValidNode methods depending on what you want to know from the method that makes use of it, like the
In this case I simply wanted to exclude tiles which have units on them but you might have other reasons for a tile to be invalid for pathing, or whatever reason you have for requesting a list of nodes around the current node. You might consider a tile wit hw all but not a unit on it as invalid if it might block a ranged shot for example.