private void Previous() { Combatant activeCombatant = Combatants.FirstOrDefault(c => c.IsActive); activeCombatant.IsActive = false; int index = Combatants.IndexOf(activeCombatant); if (index == 0) { index = Combatants.Count - 1; } else { index--; } Combatants[index].IsActive = true; }
private void Next() { Combatant activeCombatant = Combatants.FirstOrDefault(c => c.IsActive); activeCombatant.IsActive = false; int index = Combatants.IndexOf(activeCombatant); if (index == Combatants.Count - 1) { index = 0; } else { index++; } Combatants[index].IsActive = true; }