Пример #1
0
 public void SelectNextUnit(bool doneThisTurn)
 {
     var soldier = SelectedSoldier;
     if (soldier == null)
         return; //TODO: handle hwp/alien
     if (doneThisTurn)
         soldier.DoneThisTurn = true;
     var index = Soldiers.IndexOf(soldier);
     var newSelectedSoldier = Enumerable.Range(0, Soldiers.Count - 1)
         .Select(value => (index + value + 1) % Soldiers.Count)
         .Select(nextIndex => Soldiers[nextIndex])
         .FirstOrDefault(nextSoldier => !nextSoldier.DoneThisTurn);
     if (newSelectedSoldier == null)
         return;
     SelectedUnitId = new SelectedUnitId
     {
         UnitType = UnitType.Soldier,
         Id = newSelectedSoldier.Id
     };
 }
Пример #2
0
 public void StartNextTurn()
 {
     ++Turn;
     SelectedUnitId = new SelectedUnitId
     {
         UnitType = UnitType.Soldier,
         Id = Soldiers.First().Id
     };
     foreach (var soldier in Soldiers)
     {
         soldier.TimeUnits = soldier.MaxTimeUnits;
         soldier.Energy = Math.Min(soldier.MaxEnergy, soldier.Energy + soldier.Soldier.OriginalStatistics.TimeUnits / 3);
         soldier.DoneThisTurn = false;
     }
 }