Example #1
0
 public EdgePositionProvider(CoordinateWrapper coordinateWrapper, Dictionary <Vector3Int, int> EdgeIndexByPosition)
 {
     this.coordinateWrapper   = coordinateWrapper;
     this.edgeIndexByPosition = EdgeIndexByPosition;
     GetTileDistance          = new MapDistanceCalculatorTile(coordinateWrapper);
     GetCornerDistance        = new MapDistanceCalculatorCorners(coordinateWrapper);
 }
Example #2
0
        public HexMap(Dictionary <Vector3Int, int> tileIndexByPosition, CoordinateWrapper coordinateWrapper = null)
        {
            this.CoordinateWrapper   = coordinateWrapper;
            this.TileIndexByPosition = tileIndexByPosition;
            TilePositions            = new Vector3Int[TileCount];
            foreach (var kvp in TileIndexByPosition)
            {
                TilePositions[kvp.Value] = kvp.Key;
            }
            this.GetTilePosition  = new TilePositionProvider(coordinateWrapper, tileIndexByPosition);
            this.GetTilePositions = new TilePositionsProvider(coordinateWrapper, tileIndexByPosition);

            MapSizeData = HexUtility.CalculateMapCenterAndExtents(TileIndexByPosition.Keys);


            CreateEdgeIndex();
            this.GetEdgePosition  = new EdgePositionProvider(CoordinateWrapper, EdgeIndexByPosition);
            this.GetEdgePositions = new EdgePositionsProvider(CoordinateWrapper, EdgeIndexByPosition);

            CreateCornerIndex();
            this.GetCornerPosition  = new CornerPositionProvider(CoordinateWrapper, CornerIndexByPosition);
            this.GetCornerPositions = new CornersPositionsProvider(CoordinateWrapper, CornerIndexByPosition);
        }
 public EdgePositionsProvider(CoordinateWrapper coordinateWrapper, Dictionary <Vector3Int, int> EdgeIndexByPosition)
 {
     this.coordinateWrapper   = coordinateWrapper;
     this.EdgeIndexByPosition = EdgeIndexByPosition;
 }
 public TilePositionProvider(CoordinateWrapper coordinateWrapper, Dictionary <Vector3Int, int> TileIndexByPosition)
 {
     this.coordinateWrapper   = coordinateWrapper;
     this.tileIndexByPosition = TileIndexByPosition;
 }
 public MapDistanceCalculatorEdges(CoordinateWrapper coordinateWrapper)
 {
     this.coordinateWrapper = coordinateWrapper;
 }
Example #6
0
 public CornerPositionProvider(CoordinateWrapper coordinateWrapper, Dictionary <Vector3Int, int> cornerIndexByPosition)
 {
     this.coordinateWrapper     = coordinateWrapper;
     this.cornerIndexByPosition = cornerIndexByPosition;
     this.distanceCalculator    = new MapDistanceCalculatorCorners(coordinateWrapper);
 }
 public CornersPositionsProvider(CoordinateWrapper coordinateWrapper, Dictionary <Vector3Int, int> CornerIndexByPosition)
 {
     this.coordinateWrapper     = coordinateWrapper;
     this.CornerIndexByPosition = CornerIndexByPosition;
 }