コード例 #1
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;
		}