A stable modding interface between Techblox and mods https://mod.exmods.org/
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

40 rindas
1.0KB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using Svelto.Tasks;
  7. using Svelto.Tasks.Enumerators;
  8. namespace TechbloxModdingAPI.Tasks
  9. {
  10. /// <summary>
  11. /// An asynchronous task to be performed once.
  12. /// Once constructed, this can be run by scheduling it with Scheduler.Schedule()
  13. /// </summary>
  14. public class Once : ISchedulable
  15. {
  16. private Action task;
  17. private float delay;
  18. public IEnumerator<TaskContract> Run()
  19. {
  20. yield return new WaitForSecondsEnumerator(delay).Continue();
  21. task();
  22. yield return Yield.It;
  23. }
  24. /// <summary>
  25. /// Construct a single-run task
  26. /// </summary>
  27. /// <param name="task">The task to run once</param>
  28. /// <param name="after">The delay (in seconds) before the task is run</param>
  29. public Once(Action task, float after = 0.0f)
  30. {
  31. this.task = task;
  32. this.delay = after;
  33. }
  34. }
  35. }