public HashSet <IHexagon> GetTargetsInRange(IHexagon start, int range)
        {
            Queue <IHexagon>   hexQueue       = new Queue <IHexagon>();
            HashSet <IHexagon> visited        = new HashSet <IHexagon>();
            HashSet <IHexagon> targetsInRange = new HashSet <IHexagon>();


            hexQueue.Enqueue(start);
            while (hexQueue.Count != 0)
            {
                IHexagon currentHex = hexQueue.Dequeue();

                if (currentHex.MyHexMap.IsOccupied())
                {
                    if (currentHex.Contents.MyHasTurn != null)
                    {
                        targetsInRange.Add(currentHex);
                    }
                }

                foreach (IHexagon neighbour in currentHex.MyHexMap.Neighbours)
                {
                    if (HexMath.FindDistance(start, neighbour) <= range && !visited.Contains(neighbour))
                    {
                        hexQueue.Enqueue(neighbour);
                        visited.Add(neighbour);
                    }
                }
            }

            //algorithm would return the attacker as a target otherwise
            targetsInRange.Remove(start);

            return(targetsInRange);
        }
        public void find_straight_distance()
        {
            GameObject    gameObject    = new GameObject();
            MapGeneration mapGeneration = gameObject.AddComponent <MapGeneration>();

            mapGeneration.HexagonPrefab = new GameObject();
            mapGeneration.MapRadius     = 10;

            mapGeneration.HexDict = new Dictionary <Vector3Int, IHexagon>();
            mapGeneration.GenerateMap();
            mapGeneration.UpdateHexNeighbours();

            IHexagon start_hex = mapGeneration.HexDict[new Vector3Int(0, 0, 0)];
            IHexagon end_hex   = mapGeneration.HexDict[new Vector3Int(0, -4, 4)];


            int distance = 4;

            Assert.AreEqual(distance, HexMath.FindDistance(start_hex, end_hex));
        }