/// <summary> /// Resets all movement flags on the ship /// </summary> /// <param name="pingBack"></param> public async Task resetMovement(List <string> movementList, Vector2 at, double angle, Vector2 velocity, bool pingBack) { if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId)) { try { if (pingBack) { await Clients.Client(Context.ConnectionId).SendAsync("pingBack"); } Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId); if (ship.Controllable.Value) { List <Movement> result = new List <Movement>(); foreach (string where in movementList) { result.Add((Movement)Enum.Parse(typeof(Movement), where)); } ship.ResetMoving(result, at, angle, velocity); } } catch (Exception e) { _logger.LogError("resetMovement", e); } } }
/// <summary> /// Resets all movement flags on the ship /// </summary> /// <param name="pingBack"></param> public void resetMovement(List <string> movementList, Vector2 at, double angle, Vector2 velocity, bool pingBack) { if (_game.UserHandler.UserExistsAndReady(Context.ConnectionId)) { try { if (pingBack) { Clients.Caller.pingBack(); } Ship ship = _game.UserHandler.GetUserShip(Context.ConnectionId); if (ship.Controllable.Value) { List <Movement> result = new List <Movement>(); foreach (string where in movementList) { result.Add((Movement)Enum.Parse(typeof(Movement), where)); } ship.ResetMoving(result, at, angle, velocity); } } catch (Exception e) { ErrorLog.Instance.Log(e); } } }