public static void MoveTowards(this MapUnit unit, MapUnit target)
        {
            HexCoords targetLoc = map.WhereIs(target);

            IDictionary <HexCoords, PathNode> pathFlood = unit.Dijkstra();
            HexCoords destination = pathFlood.Keys.RandomPickMin(x => x.DistanceTo(targetLoc));

            game.ChangeState(new MoveUnit(
                                 unit,
                                 pathFlood[destination].pathTo));
        }
        public override void EnterState()
        {
            // If the player is out of units, defeat them
            if (map.Units(UnitTeam.player).Count() <= 0)
            {
                game.StartCoroutine(PlayerExt.PlayerLoses());
            }
            else if (playerUnit.ap > 0)
            {
                Debug.Log("Selected " + playerUnit.name);

                pathFlood = playerUnit.Dijkstra();

                IEnumerable <MapCell> floodCells = pathFlood.Values
                                                   .Select(x => x.loc)
                                                   .Select(map.CellAt);
                IEnumerable <MapCell> threatCells = floodCells
                                                    .Where(x => playerUnit.InThreat(x));

                AddShimmer(floodCells);
                foreach (MapCell cell in threatCells)
                {
                    cell.tint = Color.Lerp(Color.red, Color.white, 0.25f);
                }

                map.events.pointerEnter += PointerEnter;
                map.events.pointerExit  += PointerExit;
                map.events.pointerClick += PointerClick;

                ui.signal += GuiSignal;

                game.mouseDown += MouseDown;

                ui.jumpButton.Activate();
            }
            else
            {
                Debug.Log("Tried to select " + playerUnit.name + ", no actions remaining.");
                game.StartCoroutine(ExitToSelectUnit());
            }

            base.EnterState();
        }