public static IEnumerator ToUnity(this WaitCommand waitCommand, StartRoutine startRoutine) { if (waitCommand.IsRoutine) { var runningRoutines = new UnityEngine.Coroutine[waitCommand.RoutineCount]; for (int i = 0; i < waitCommand.RoutineCount; i++) { var routine = waitCommand.GetRoutine(i).ToUnity(startRoutine); var runningRoutine = startRoutine(routine); runningRoutines[i] = runningRoutine; } for (int i = 0; i < runningRoutines.Length; i++) { var runningRoutine = runningRoutines[i]; yield return(runningRoutine); } } else { if (waitCommand.Duration.Value.Seconds > 0f) { yield return(new WaitForSeconds(waitCommand.Duration.Value.Seconds)); } else { for (int i = 0; i < waitCommand.Duration.Value.FrameCount; i++) { yield return(null); } } } }
/// <summary> /// Method to create an object from a set of object attributes. /// </summary> /// <param name="obj_attributes">The object attributes to create/open from.</param> /// <returns>The newly created object.</returns> protected override object CreateObject(ObjectAttributes obj_attributes) { NtProcess process = Process ?? NtProcess.Current; return(NtThread.Create(obj_attributes, Access, process, StartRoutine.ToInt64(), Argument.ToInt64(), CreateFlags, ZeroBits.ToInt64(), StackSize.ToInt64(), MaximumStackSize.ToInt64(), null)); }
public static IEnumerator ToUnity(this IEnumerator <WaitCommand> routine, StartRoutine startRoutine) { return(routine.AsWaitCommand().ToUnity(startRoutine)); }