//There is no nice way of knowing which toggle is active.
 private void OnvalueChangedCallback(Toggle toggle, int index)
 {
     if (_toggleGroup.ActiveToggles().FirstOrDefault() == toggle)
     {
         _selectedUnit.SelectSkill(index);
     }
 }
Exemple #2
0
    public HexUnit GetNextUnit()
    {
        if (_units.Count == 0)
        {
            return(null);
        }
        HexUnit hexUnit = _units.Dequeue();

        //Unit might be dead waiting to be pooled.
        if (!hexUnit.IsDead)
        {
            _units.Enqueue(hexUnit);

            //Process after enqueue to prevent false positive gameover in armies as small as 1 unit.
            hexUnit.SelectSkill(-1);
            hexUnit.ToggleWeapons(true);
            hexUnit.BeginTurn();
        }
        return(hexUnit);
    }