﻿using System;
using UnityEngine;

namespace Gamelogic.Grids.Examples
{
	public class SpherePointyHexMapBuilder : CustomMap3DBuilder
	{
		public Vector3 radius = Vector3.one*100;
		

		public override IMap3D<TPoint> CreateMap<TPoint>()
		{
			return (IMap3D<TPoint>) CreateMeshMap<TPoint>();
		}

		public override IMeshMap<TPoint> CreateMeshMap<TPoint>()
		{
			if (typeof(TPoint) != typeof(PointyHexPoint))
			{
				throw new Exception("This CustomeMap3DBuilder must be used with Pointy Hex Grids");
			}

			var gridBuilder = GetComponent<PointyHexMeshGridBuilder>();

			return (IMeshMap<TPoint>)new SpherePointyHexMap(gridBuilder.Grid, gridBuilder.cellDimensions, radius);
		}
	}


}