public override LaserFactory.LaserDirection Reflect(MirrorFactory.Direction orientation, LaserFactory.LaserDirection directionOfTravel) { if (orientation == MirrorFactory.Direction.Right) { switch (directionOfTravel) { case LaserFactory.LaserDirection.Down: return(LaserFactory.LaserDirection.Left); case LaserFactory.LaserDirection.Right: return(LaserFactory.LaserDirection.Up); default: return(directionOfTravel); } } switch (directionOfTravel) //orientation must be left { case LaserFactory.LaserDirection.Up: return(LaserFactory.LaserDirection.Left); case LaserFactory.LaserDirection.Right: return(LaserFactory.LaserDirection.Down); default: return(directionOfTravel); } }
public Mirror(int xLocation, int yLocation, MirrorFactory.Direction direction, MirrorFactory.MirrorType type, ReflectionStrategy strategy) { XLocation = xLocation; YLocation = yLocation; Direction = direction; Type = type; _reflectionStrategy = strategy; }
public override LaserFactory.LaserDirection Reflect(MirrorFactory.Direction orientation, LaserFactory.LaserDirection directionOfTravel) { if (orientation == MirrorFactory.Direction.Right) { switch (directionOfTravel) { case LaserFactory.LaserDirection.Right: return(LaserFactory.LaserDirection.Up); case LaserFactory.LaserDirection.Left: return(LaserFactory.LaserDirection.Down); case LaserFactory.LaserDirection.Up: return(LaserFactory.LaserDirection.Right); case LaserFactory.LaserDirection.Down: return(LaserFactory.LaserDirection.Left); default: throw new Exception("Direction not implemented"); } } switch (directionOfTravel) { case LaserFactory.LaserDirection.Right: return(LaserFactory.LaserDirection.Down); case LaserFactory.LaserDirection.Left: return(LaserFactory.LaserDirection.Up); case LaserFactory.LaserDirection.Up: return(LaserFactory.LaserDirection.Left); case LaserFactory.LaserDirection.Down: return(LaserFactory.LaserDirection.Right); default: throw new Exception("Direction not implemented"); } }
public abstract LaserFactory.LaserDirection Reflect(MirrorFactory.Direction orientation, LaserFactory.LaserDirection directionOfTravel);