public bool Act() { // if key available, make action, otherwise use the same direction as last time if (Console.KeyAvailable) { var pressed = Console.ReadKey(true).Key; if (pressed == _up) { _direction = Direction.Up; } else if (pressed == _right) { _direction = Direction.Right; } else if (pressed == _down) { _direction = Direction.Down; } else if (pressed == _left) { _direction = Direction.Left; } } return(CurrentGame.Move(_direction)); }
public void Move(string originalPosition, string newPosition) { bool originalPosIsNull = string.IsNullOrWhiteSpace(originalPosition); bool newPosIsNull = string.IsNullOrWhiteSpace(newPosition); if (CurrentGame != null && CurrentPlayer != null && !originalPosIsNull && !newPosIsNull) { CurrentGame.Move(CurrentPlayer, originalPosition, newPosition); WriteInfo(); } }