Example #1
0
    // Player left clicked on the unit
    public void UnitSelected(Unit unit)
    {
        //UnitDeselected();
        StopRotatingUnit();
        ShowUnitStatsPanel(unit);

        if (unit.owner == BattleManager.battle_manager.current_player)
        {
            selected_unit = unit;

            //unit.unit_menu.SetActive(true);

            PopulateAbilitiesMenu(unit);

            // Check all enemies and see if they are within attack range of the selected unit
            foreach (Unit enemy in unit.owner.GetAllEnemyUnits())
            {
                if (HexMap.hex_map.InRange(unit.location, enemy.location, unit.GetRange()))
                {
                    enemy.location.HighlightAttackableHex(!unit.has_attacked && unit.active);
                }
            }
        }

        UnhighlightHexes();

        unit.HighlightHexesWeCanMoveTo(unit.has_moved);

        HighlightAttacksFrom(unit, unit.location);
    }