Пример #1
0
 private static void SetCurrentDelay(Delay delay)
 {
     if (delay.Randomize && Random.Next(0, 101) >= (100 - delay.Probability))
     {
         if (delay.Default > 0)
         {
             var min = (delay.Default / 100f) * delay.MinDelay;
             var max = (delay.Default / 100f) * delay.MaxDelay;
             delay.CurrentDelay = Random.Next(
                 (int) Math.Floor(Math.Min(min, max)), (int) Math.Ceiling(Math.Max(min, max)) + 1);
         }
         else
         {
             delay.CurrentDelay = 0;
         }
     }
     else
     {
         delay.CurrentDelay = delay.Default > 0
             ? Random.Next(
                 (int) Math.Floor(delay.Default * (delay.Default >= 50 ? 0.95f : 0.9f)),
                 (int) Math.Ceiling(delay.Default * (delay.Default >= 50 ? 1.05f : 1.1f)) + 1)
             : delay.Default;
     }
 }
Пример #2
0
 public static void SetDelayRandomize(bool value, OrbwalkingDelay delay)
 {
     Delay delayEntry;
     if (Delays.TryGetValue(delay, out delayEntry))
     {
         delayEntry.Randomize = value;
     }
     else
     {
         Delays[delay] = new Delay { Randomize = value };
     }
 }
Пример #3
0
 public static void SetMinDelay(float value, OrbwalkingDelay delay)
 {
     Delay delayEntry;
     if (Delays.TryGetValue(delay, out delayEntry))
     {
         delayEntry.MinDelay = value;
     }
     else
     {
         Delays[delay] = new Delay { MinDelay = value };
     }
 }
Пример #4
0
 public static void SetDelayProbability(float value, OrbwalkingDelay delay)
 {
     Delay delayEntry;
     if (Delays.TryGetValue(delay, out delayEntry))
     {
         delayEntry.Probability = value;
     }
     else
     {
         Delays[delay] = new Delay { Probability = value };
     }
 }