extracommands/extracommands/WaitCommandEngine.cs
2019-10-22 20:40:04 -04:00

37 lines
1 KiB
C#

using System;
using RobocraftX.GUI.CommandLine;
using RobocraftX.Multiplayer;
using RobocraftX.StateSync;
using RobocraftX.Character;
using Svelto.ECS;
using Unity.Entities;
using UnityEngine;
using uREPL;
using Svelto.Context;
using RobocraftX;
namespace ExtraCommands.Basics
{
[CustomCommand("Wait", "Delay execution for a length of time (ms)")]
class WaitCommandEngine : CustomCommandEngine
{
public WaitCommandEngine(UnityContext<FullGameCompositionRoot> ctxHolder, EnginesRoot enginesRoot, World physW, Action reloadGame, MultiplayerInitParameters mpParams) : base(ctxHolder, enginesRoot, physW, reloadGame, mpParams)
{
}
public override void Ready()
{
uREPL.RuntimeCommands.Register<int>("Wait", WaitCommand, "Delay execution for a length of time (ms)");
}
private void WaitCommand(int ms)
{
System.Threading.Thread.Sleep(ms);
}
public override void Dispose()
{
uREPL.RuntimeCommands.Unregister("Wait");
}
}
}