public void SwitchSystem() { bool canSwitch = false; foreach (KeyValuePair <MechSystem, int> kp in systems) { if (kp.Value > 0) { canSwitch = true; break; } } if (!canSwitch) { return; } do { currentSystem = (MechSystem)Random.Range(0, System.Enum.GetNames(typeof(MechSystem)).Length); } while (systems[currentSystem] != 0); }
public bool IsIntact(MechSystem system) => systems[system] > 0;