Exemplo n.º 1
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);
    }