public static Twelfth EarliestTwelfthInAverageTemperatureRange(int tile, float minTemp, float maxTemp) { for (int i = 0; i < 12; i++) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, (Twelfth)(byte)i); if (num >= minTemp && num <= maxTemp) { if (i != 0) { return((Twelfth)(byte)i); } Twelfth twelfth = (Twelfth)i; int num2 = 0; while (num2 < 12) { float num3 = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, twelfth.PreviousTwelfth()); if (!(num3 < minTemp) && !(num3 > maxTemp)) { twelfth = twelfth.PreviousTwelfth(); num2++; continue; } return(twelfth); } return((Twelfth)(byte)i); } } return(Twelfth.Undefined); }
public static Twelfth EarliestTwelfthInAverageTemperatureRange(int tile, float minTemp, float maxTemp) { int i = 0; while (i < 12) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, (Twelfth)i); if (num >= minTemp && num <= maxTemp) { if (i != 0) { return((Twelfth)i); } Twelfth twelfth = (Twelfth)i; for (int j = 0; j < 12; j++) { float num2 = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, twelfth.PreviousTwelfth()); if (num2 < minTemp || num2 > maxTemp) { return(twelfth); } twelfth = twelfth.PreviousTwelfth(); } return((Twelfth)i); } else { i++; } } return(Twelfth.Undefined); }
public static List <Twelfth> TwelfthsInAverageTemperatureRange(int tile, float minTemp, float maxTemp) { List <Twelfth> twelfths = new List <Twelfth>(); for (int i = 0; i < 12; i++) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, (Twelfth)(byte)i); if (num >= minTemp && num <= maxTemp) { twelfths.Add((Twelfth)(byte)i); } } if (twelfths.Count > 1 && twelfths.Count != 12) { if (twelfths.Contains(Twelfth.Twelfth) && twelfths.Contains(Twelfth.First)) { Twelfth twelfth = twelfths.First((Twelfth m) => !twelfths.Contains(m - 1)); List <Twelfth> list = new List <Twelfth>(); int num2 = (int)twelfth; while (num2 < 12 && twelfths.Contains((Twelfth)(byte)num2)) { list.Add((Twelfth)(byte)num2); num2++; } int num3 = 0; while (num3 < 12 && twelfths.Contains((Twelfth)(byte)num3)) { list.Add((Twelfth)(byte)num3); num3++; } } return(twelfths); } return(twelfths); }
public static List <Twelfth> TwelfthsInAverageTemperatureRange(int tile, float minTemp, float maxTemp) { List <Twelfth> twelfths = new List <Twelfth>(); for (int i = 0; i < 12; i++) { float num = GenTemperature.AverageTemperatureAtTileForTwelfth(tile, (Twelfth)i); if (num >= minTemp && num <= maxTemp) { twelfths.Add((Twelfth)i); } } List <Twelfth> twelfths2; if (twelfths.Count <= 1 || twelfths.Count == 12) { twelfths2 = twelfths; } else { if (twelfths.Contains(Twelfth.Twelfth) && twelfths.Contains(Twelfth.First)) { Twelfth twelfth = twelfths.First((Twelfth m) => !twelfths.Contains((Twelfth)(m - Twelfth.Second))); List <Twelfth> list = new List <Twelfth>(); for (int j = (int)twelfth; j < 12; j++) { if (!twelfths.Contains((Twelfth)j)) { break; } list.Add((Twelfth)j); } for (int k = 0; k < 12; k++) { if (!twelfths.Contains((Twelfth)k)) { break; } list.Add((Twelfth)k); } } twelfths2 = twelfths; } return(twelfths2); }