/// <summary> /// Check in which direction snake should move. /// </summary> private Direction CheckMoveDir() { Direction newDir; if (_turnCommand != null) { newDir = _turnCommand.dir; _turnCommand = null; } else { newDir = Direction.FORWARD; } return(newDir); }
/// <summary> /// Sets turn command. So in next movement snake will turn. /// </summary> private void OnTurnCommand(EventArgs args) { _turnCommand = (args as SnakeTurnCommandArgs).turnCommand; }