Beispiel #1
0
 /// <summary>
 /// Wait for message with requested type in 'this' queue
 /// </summary>
 /// <returns>first message in queue if it matches for request type. Null if exited by condition</returns>
 public T WaitForMessage(Type type, FinishCondition finish = null, LoopAction action = null)
 {
     while (true)
     {
         if (finish != null && finish())
         {
             return(null);
         }
         if (action != null)
         {
             action.Execute();
         }
         CloudQueueMessage startMsg = GetMessage();
         if (startMsg == null)
         {
             System.Threading.Thread.Sleep(1000);
             continue;
         }
         DeleteMessage(startMsg);
         T message = ConvertMessage(startMsg);
         if (message.GetType() == type)
         {
             return(message);
         }
     }
 }
        private void OnChallengeFinished(FlightStatistics player, FinishCondition finishCondition)
        {
            Debug.Log(_activeChallenge.Value.Name + " challenge finished");
            _activeChallenge = Maybe.Nothing <Challenge>();
            // Enable all gates
            for (int i = 0; i < _gates.Length; i++)
            {
                _gates[i].gameObject.SetActive(true);
            }

            // TODO Allow players to restart a challenge
            // Restart
//            else {
//                _coroutineScheduler.Run(BeginChallenge(_activeChallenge.Value, player));
//            }
        }