/* * TileRules are added to tiles and used to set up gridgraph, this method checks if the car can move in a * particular direction from their current postion. */ private bool Traversable(Vector3 from, Vector3 to, TileRules tileRules) { if (from.z.Equals(to.z)) { if (to.x.Equals(from.x + 1)) { return(tileRules.NE); } if (to.x.Equals(from.x - 1)) { return(tileRules.SW); } } else if (from.x.Equals(to.x)) { if (to.z.Equals(from.z + 1)) { return(tileRules.NW); } if (to.z.Equals(from.z - 1)) { return(tileRules.SE); } } return(false); }
public Node(Vector3 position, TileRules tileRules, float height, HashSet <INode> neighbours) { Position = position + new Vector3(0, height, 0); TileRules = tileRules; Height = height; NextNodes = neighbours; Passable = true; }