private void WithdrawFrom(AdjacencyMask direction) { PathNode neighbor = TraverseConnection(direction); if (neighbor != null) { neighbor.SetConnection(Reverse(direction), null); } }
private PathNode TraverseConnection(AdjacencyMask direction) { PathNode node; if (!connectionDictionary.TryGetValue(direction, out node)) { return(null); } return(node); }
public void SetConnection(AdjacencyMask direction, PathNode connection) { if (connection != null) { adjacencies |= direction; } else { adjacencies &= ~direction; } connectionDictionary[direction] = connection; UpdateVisual(); }
private AdjacencyMask Reverse(AdjacencyMask dir) { switch (dir) { case AdjacencyMask.north: dir = AdjacencyMask.south; break; case AdjacencyMask.south: dir = AdjacencyMask.north; break; case AdjacencyMask.east: dir = AdjacencyMask.west; break; case AdjacencyMask.west: dir = AdjacencyMask.east; break; } return(dir); }
private void UpdateVisual(AdjacencyMask direction) { meshDictionary[direction].SetActive((adjacencies & direction) != 0); }