public void StartStop(IHubContext <DeepTalk> hubContext) { if (Running) { _hubContext.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, "Arrêt du script...", Character.TcpId), Character.TcpId); Debug.WriteLine("Stop Script"); Running = false; Character.OnStateChanged -= ProcessAction; ActionManager.Stop(); } else { _hubContext = hubContext; _hubContext.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, "Lancement du script...", Character.TcpId), Character.TcpId); if (Character.Trajet == null) { _hubContext.DispatchToClient(new LogMessage(LogType.GAME_INFORMATION, "Aucun script sélectionné", Character.TcpId), Character.TcpId); return; } Debug.WriteLine("Start Script"); Running = true; Character.OnStateChanged += ProcessAction; ActionManager.Start(hubContext); ProcessAction(); } }