コード例 #1
0
ファイル: MoveTo.cs プロジェクト: yannickbattail/Ailurus
 public MoveTo(IPlayerContext playerContext, IDrone drone, DateTime startedAt, ICoordinate source, ICoordinate destination)
 {
     if (destination == null)
     {
         throw new ArgumentException("missing destination for MoveTo instruction");
     }
     if (source == null)
     {
         throw new ArgumentException("missing destination for MoveTo instruction");
     }
     if (source.IsNear(destination))
     {
         throw new InvalidInstructionException("The drone is already at destination");
     }
     if (!playerContext.GetMap().IsInside(destination))
     {
         throw new InvalidInstructionException("Destination is outside of the map.");
     }
     Drone         = drone;
     StartedAt     = startedAt;
     StartPosition = source;
     Destination   = destination;
 }