Пример #1
0
 private BuildRequestBlocker(int blockedGlobalRequestId, string[] targetsInProgress)
 {
     _blockedGlobalRequestId  = blockedGlobalRequestId;
     _blockingGlobalRequestId = BuildRequest.InvalidGlobalRequestId;
     _targetsInProgress       = targetsInProgress;
     _yieldAction             = YieldAction.None;
 }
Пример #2
0
 /// <summary>
 /// Repeats the passed <see cref="YieldInstruction"/> either the
 /// specified number of times or forever if not specified.
 /// <br/><br/>
 /// You can use <see cref="YieldWhile"/> to repeat your custom
 /// action until a condition is met. This is different from
 /// <see cref="RepeatWhile"/> and <see cref="RepeatEverySeconds"/>
 /// in that you can be more specific about what you want to yield
 /// between repetitions.
 /// </summary>
 /// <example><code>
 /// var launch = Repeat(() => {
 ///     _rb.AddForce(Vector3.up * Push);
 ///     return new WaitForFixedUpdate();
 /// }, (int) (LaunchTime / Time.fixedDeltaTime));
 ///
 /// var areWeThereYet = Repeat(() => {
 ///     Say("Are we there yet?");
 ///     return new WaitForSeconds(Interval);
 /// }).YieldWhile(NotThere);
 /// </code></example>
 /// <param name="action">
 /// The action containing a single step of a coroutine and returns a value to be yielded repeatedly.
 /// </param>
 /// <param name="times">
 /// The optional number of times the passed action is called and yielded.
 /// </param>
 public static IEnumerator Repeat([NotNull] YieldAction action, [CanBeNull] int?times = null)
 {
     for (var i = 0; i != times; ++i)
     {
         yield return(action());
     }
 }
Пример #3
0
 internal BuildRequestBlocker(int blockedGlobalRequestId)
 {
     _blockedGlobalRequestId  = blockedGlobalRequestId;
     _blockingGlobalRequestId = blockedGlobalRequestId;
     _targetsInProgress       = null;
     _yieldAction             = YieldAction.None;
 }
Пример #4
0
 internal BuildRequestBlocker(int blockedGlobalRequestId, string[] targetsInProgress, YieldAction action)
     : this(blockedGlobalRequestId, targetsInProgress)
 {
     _yieldAction             = action;
     _blockingGlobalRequestId = blockedGlobalRequestId;
 }
Пример #5
0
 /// <summary>
 /// 'Constructor' for a singleton coroutine.
 /// Takes a <see cref="YieldInstruction"/>,
 /// executes it's code and `yield return`s the result.
 /// <br/><br/>
 /// By chaining calls of <see cref="Do(CoreLibrary.Coroutines.YieldAction)"/>,
 /// <see cref="AndThen"/> and <see cref="YieldWhile"/>
 /// you can construct any coroutine from functions only.
 /// </summary>
 /// <param name="action">
 /// The action containing a single step of a coroutine and returns a value to be yielded.
 /// </param>
 /// <returns>
 /// A singleton coroutine, which when executed calls the passed action and yields the action's result.
 /// </returns>
 public static IEnumerator Do([NotNull] YieldAction action)
 {
     yield return(action());
 }
Пример #6
0
 /// <summary>
 /// Constructor for common values.
 /// </summary>
 private BuildRequestBlocker(int blockedGlobalRequestId, string[] targetsInProgress)
 {
     _blockedGlobalRequestId = blockedGlobalRequestId;
     _blockingGlobalRequestId = BuildRequest.InvalidGlobalRequestId;
     _targetsInProgress = targetsInProgress;
     _yieldAction = YieldAction.None;
 }
Пример #7
0
 /// <summary>
 /// Constructor for a blocker used by results-transfer requests
 /// </summary>
 /// <param name="blockedGlobalRequestId">The request needing results transferred</param>
 internal BuildRequestBlocker(int blockedGlobalRequestId)
 {
     _blockedGlobalRequestId = blockedGlobalRequestId;
     _blockingGlobalRequestId = blockedGlobalRequestId;
     _targetsInProgress = null;
     _yieldAction = YieldAction.None;
 }
Пример #8
0
 /// <summary>
 /// Constructor for a blocker used by yielding requests.
 /// </summary>
 internal BuildRequestBlocker(int blockedGlobalRequestId, string[] targetsInProgress, YieldAction action)
     : this(blockedGlobalRequestId, targetsInProgress)
 {
     _yieldAction = action;
     _blockingGlobalRequestId = blockedGlobalRequestId;
 }