Exemple #1
0
        /// <summary>
        /// Начальная отрисовка поля
        /// </summary>
        private void DrawNewField()
        {
            var position = _robot.Position;

            position.X++;
            position.Y++;
            _robot.WriteNewRobotPosition((int)position.X, (int)position.Y);

            UpdateBackPattern();
            DrawField();
        }
Exemple #2
0
        /// <summary>
        /// Выполнение текущего действия
        /// </summary>
        /// <param name="robot"></param>
        /// <param name="algorithm"></param>
        /// <param name="field"></param>
        public override void Execute(MainCharacter robot, Algorithm algorithm, Field field)
        {
            var move = robot.CurrentAction as Move;

            switch (robot.Direction)
            {
            case Side.Right:
                robot.WriteNewRobotPosition(move.CellAmount, 0);
                break;

            case Side.Left:
                robot.WriteNewRobotPosition(-move.CellAmount, 0);
                break;

            case Side.Up:
                robot.WriteNewRobotPosition(0, -move.CellAmount);
                break;

            case Side.Down:
                robot.WriteNewRobotPosition(0, move.CellAmount);
                break;
            }
        }