示例#1
0
文件: Waiters.cs 项目: Zeludon/FEZ
 public static IWaiter Wait(double secondsToWait, Action onValid)
 {
   Func<Waiters.TimeKeeper, bool> condition = (Func<Waiters.TimeKeeper, bool>) (waited => waited.Elapsed.TotalSeconds > secondsToWait);
   Action<TimeSpan, Waiters.TimeKeeper> whileWaiting = (Action<TimeSpan, Waiters.TimeKeeper>) ((elapsed, waited) => waited.Elapsed += elapsed);
   Action onValid1 = onValid;
   Waiter<Waiters.TimeKeeper> waiter;
   ServiceHelper.AddComponent((IGameComponent) (waiter = new Waiter<Waiters.TimeKeeper>(condition, whileWaiting, onValid1)));
   return (IWaiter) waiter;
 }
示例#2
0
文件: Waiters.cs 项目: Zeludon/FEZ
 public static IWaiter Interpolate(double durationSeconds, Action<float> assignation, Action onComplete)
 {
   if (durationSeconds == 0.0)
   {
     onComplete();
     return (IWaiter) null;
   }
   else
   {
     Waiter<Waiters.TimeKeeper> waiter;
     ServiceHelper.AddComponent((IGameComponent) (waiter = new Waiter<Waiters.TimeKeeper>((Func<Waiters.TimeKeeper, bool>) (waited => waited.Elapsed.TotalSeconds > durationSeconds), (Action<TimeSpan, Waiters.TimeKeeper>) ((elapsed, waited) =>
     {
       waited.Elapsed += elapsed;
       assignation((float) (waited.Elapsed.TotalSeconds / durationSeconds));
     }), onComplete)));
     return (IWaiter) waiter;
   }
 }
示例#3
0
文件: Waiters.cs 项目: Zeludon/FEZ
 public static IWaiter Wait(Func<bool> endCondition, Action onValid)
 {
   Waiter waiter;
   ServiceHelper.AddComponent((IGameComponent) (waiter = new Waiter(endCondition, onValid)));
   return (IWaiter) waiter;
 }
示例#4
0
文件: Waiters.cs 项目: Zeludon/FEZ
 public static IWaiter DoUntil(Func<bool> endCondition, Action<float> action, Action onComplete)
 {
   Waiter waiter;
   ServiceHelper.AddComponent((IGameComponent) (waiter = new Waiter(endCondition, (Action<TimeSpan>) (elapsed => action((float) elapsed.TotalSeconds)), onComplete)));
   return (IWaiter) waiter;
 }