Ejemplo n.º 1
0
        protected override IMap3D <FlatHexPoint> CreateMap()
        {
            switch (mapType)
            {
            case MapType.Hex:
            {
                var windowedMap = new FlatHexMap(cellDimensions.HadamardMul(CellSpacingFactor))
                                  .WithWindow(CenterRect);

                return(GetAlignedMap(windowedMap));
            }

            case MapType.Brick:
            {
                var windowedMap = new FlatBrickMap(cellDimensions.HadamardMul(CellSpacingFactor))
                                  .WithWindow(CenterRect);

                return(GetAlignedMap(windowedMap));
            }

            case MapType.Custom:
            {
                var map = GetCustomMap3D();

                return(map);
            }

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Ejemplo n.º 2
0
        protected override WindowedMap <FlatHexPoint> CreateWindowedMap()
        {
            WindowedMap <FlatHexPoint> windowedHexMap;

            float   cellWidth;
            float   cellHeight;
            Vector2 cellDimensions;

            switch (mapType)
            {
            case MapType.Hex:
                cellWidth      = CellPrefab.Dimensions.x;
                cellHeight     = CellPrefab.Dimensions.x / 80 * 69;
                cellDimensions = new Vector2(cellWidth, cellHeight);

                windowedHexMap = new FlatHexMap(cellDimensions * CellSpacingFactor)
                                 .WithWindow(CenterRect);
                break;

            case MapType.Brick:

                cellWidth      = CellPrefab.Dimensions.x;
                cellHeight     = CellPrefab.Dimensions.y;
                cellDimensions = new Vector2(cellWidth, cellHeight);

                windowedHexMap = new FlatBrickMap(cellDimensions * CellSpacingFactor)
                                 .WithWindow(CenterRect);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            return(windowedHexMap);
        }
Ejemplo n.º 3
0
        public PointyTriMap(Vector2 cellDimensions) :
            base(cellDimensions)
        {
            var hexDimensions =
                new Vector2(4f / 3f * cellDimensions.x, cellDimensions.y);

            baseMap = new FlatHexMap(hexDimensions);
        }
Ejemplo n.º 4
0
        public PointyTriMap(Vector2 cellDimensions) :
            base(cellDimensions)
        {
            Vector2 hexDimensions = cellDimensions;

            hexDimensions.x = 2 * hexDimensions.x / 1.5f;

            baseMap = new FlatHexMap(hexDimensions);
        }
Ejemplo n.º 5
0
		protected override WindowedMap<FlatHexPoint> CreateWindowedMap()
		{
			WindowedMap<FlatHexPoint> windowedHexMap;

			float cellWidth;
			float cellHeight;
			Vector2 cellDimensions;

			switch (mapType)
			{
				case MapType.Hex:
					cellWidth = CellPrefab.Dimensions.x;
					cellHeight = CellPrefab.Dimensions.y;
					cellDimensions = new Vector2(cellWidth, cellHeight);

					windowedHexMap = new FlatHexMap(cellDimensions.HadamardMul(CellSpacingFactor))
						.WithWindow(CenterRect);
					break;
				case MapType.Brick:

					cellWidth = CellPrefab.Dimensions.x;
					cellHeight = CellPrefab.Dimensions.y;
					cellDimensions = new Vector2(cellWidth, cellHeight);

					windowedHexMap = new FlatBrickMap(cellDimensions.HadamardMul(CellSpacingFactor))
						.WithWindow(CenterRect);
					break;
				case MapType.Custom:
					windowedHexMap = GetComponent<CustomMapBuilder>().CreateWindowedMap<FlatHexPoint>();
					break;
				default:
					throw new ArgumentOutOfRangeException();
			}

			return windowedHexMap;
		}