﻿using System;
using UnityEngine;

namespace Gamelogic.Grids.Examples
{
	public class TorusPointyHexMapBuilder : CustomMap3DBuilder
	{
		public Vector2 smallRadius = Vector2.one * 50;
		public Vector2 bigRadius = Vector2.one * 200;

		public int halfTwistCount = 1;

		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 TorusPointyHexMap(gridBuilder.Grid, gridBuilder.cellDimensions, smallRadius, bigRadius);
		}
	}


}