Moar Gamecraft commands!
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.0KB

  1. using System;
  2. using RobocraftX.GUI.CommandLine;
  3. using RobocraftX.Multiplayer;
  4. using RobocraftX.StateSync;
  5. using RobocraftX.Character;
  6. using Svelto.ECS;
  7. using Unity.Entities;
  8. using UnityEngine;
  9. using uREPL;
  10. using Svelto.Context;
  11. using RobocraftX;
  12. namespace ExtraCommands.Basics
  13. {
  14. [CustomCommand("Wait", "Delay execution for a length of time (ms)")]
  15. class WaitCommandEngine : CustomCommandEngine
  16. {
  17. public WaitCommandEngine(UnityContext<FullGameCompositionRoot> ctxHolder, EnginesRoot enginesRoot, World physW, Action reloadGame, MultiplayerInitParameters mpParams) : base(ctxHolder, enginesRoot, physW, reloadGame, mpParams)
  18. {
  19. }
  20. public override void Ready()
  21. {
  22. uREPL.RuntimeCommands.Register<int>("Wait", WaitCommand, "Delay execution for a length of time (ms)");
  23. }
  24. private void WaitCommand(int ms)
  25. {
  26. System.Threading.Thread.Sleep(ms);
  27. }
  28. public override void Dispose()
  29. {
  30. uREPL.RuntimeCommands.Unregister("Wait");
  31. }
  32. }
  33. }