private void SwitchColor(bool inverse) { Debug.Log("Switching colors " + (inverse ? "" : "inverted")); if (tanks.Keys.Count == 0) { currentColor = null; lastColor = null; } else { currentColor = currentColor == null ? lastColor : currentColor; currentColor = currentColor == null ? GameColor.Red : currentColor; currentColor = currentColor.NextColor(inverse); while (!tanks.ContainsKey(currentColor)) { currentColor = currentColor.NextColor(inverse); } } }