public static IEnumerable <Vector3> GetNeighbourLinePoints(this HexVector hex, IEnumerable <HexVector> neighboursNotInRegion) { var result = new List <Vector3>(); var vertices = GetVertices(); var notInRegion = neighboursNotInRegion.NotNull(); if (notInRegion.Contains(hex.Add(HexVector.UP))) { result.Add(vertices[0]); result.Add(vertices[1]); } if (notInRegion.Contains(hex.Add(HexVector.UP_RIGHT))) { result.Add(vertices[1]); result.Add(vertices[2]); } if (notInRegion.Contains(hex.Add(HexVector.DOWN_RIGHT))) { result.Add(vertices[2]); result.Add(vertices[3]); } if (notInRegion.Contains(hex.Add(HexVector.DOWN))) { result.Add(vertices[3]); result.Add(vertices[4]); } if (notInRegion.Contains(hex.Add(HexVector.DOWN_LEFT))) { result.Add(vertices[4]); result.Add(vertices[5]); } if (notInRegion.Contains(hex.Add(HexVector.UP_LEFT))) { result.Add(vertices[5]); result.Add(vertices[0]); } return(result.Select(v => v + new Vector3(hex.GetPositionX(), hex.GetPositionY(), 0))); }
public static Vector2 GetVector2(this HexVector hex) { return(new Vector2(hex.GetPositionX(), hex.GetPositionY())); }
public static Vector3[] CreateLinePairVerts(this HexVector vector) { var positionOffset = new Vector3(vector.GetPositionX(), vector.GetPositionY()); return(CreateLinePairVerts().Select(vector3 => vector3 + positionOffset).ToArray()); }