Exemplo n.º 1
0
        public override RoboAction OnRobotEnter(ActionPhase actionPhase, RoboMovement movement, RoboPosition position)
        {
            RoboPosition nextPosition = movement.PerformAction(position, this.Board);

            //Moving possible?
            if (!nextPosition.Equals(position))
            {
                return(movement);
            }

            return(base.OnRobotEnter(actionPhase, movement, position));
        }
Exemplo n.º 2
0
 public override RoboAction OnRobotEnter(ActionPhase actionPhase, RoboMovement movement, RoboPosition position)
 {
     switch (actionPhase)
     {
     case ActionPhase.ActionConveyor:
         return(new RoboRotation
                (
                    (movement.Direction == Direction.Up && (FieldType & FieldType.ConveyorLeft) == FieldType.ConveyorLeft) ||
                    (movement.Direction == Direction.Right && (FieldType & FieldType.ConveyorUp) == FieldType.ConveyorUp) ||
                    (movement.Direction == Direction.Down && (FieldType & FieldType.ConveyorRight) == FieldType.ConveyorRight) ||
                    (movement.Direction == Direction.Left && (FieldType & FieldType.ConveyorDown) == FieldType.ConveyorDown) ?
                    Rotation.Left :
                    ((movement.Direction == Direction.Up && (FieldType & FieldType.ConveyorRight) == FieldType.ConveyorRight) ||
                     (movement.Direction == Direction.Right && (FieldType & FieldType.ConveyorDown) == FieldType.ConveyorDown) ||
                     (movement.Direction == Direction.Down && (FieldType & FieldType.ConveyorLeft) == FieldType.ConveyorLeft) ||
                     (movement.Direction == Direction.Left && (FieldType & FieldType.ConveyorUp) == FieldType.ConveyorUp) ?
                     Rotation.Right : Rotation.None)
                ));
     }
     return(base.OnRobotEnter(actionPhase, movement, position));
 }
Exemplo n.º 3
0
 public virtual RoboAction OnRobotEnter(ActionPhase actionPhase, RoboMovement movement, RoboPosition position)
 {
     return(null);
 }