Пример #1
0
        public void Reset(WaypointTask holdTask, WaypointTask approachTask, WaypointTask enterTask, WaypointTask closeTask, DockTask dockTask, MyTuple <IntelItemType, long> intelKey, MyGridProgram program, MyCubeSize dockSize, IMyTerminalBlock connector, IMyTerminalBlock indicator = null)
        {
            Reset();
            if (indicator != null)
            {
                Indicator = indicator;
                Connector = connector;
            }
            EnterHoldingPattern = holdTask;
            WaitForClearance    = new WaitTask();
            ApproachEntrance    = approachTask;
            ApproachDock        = enterTask;
            FinalAdjustToDock   = closeTask;
            DockTask            = dockTask;
            IntelKey            = intelKey;
            DockSize            = dockSize;
            Program             = program;

            closeTask.Destination.MaxSpeed = 0.5f;
            enterTask.Destination.MaxSpeed = 5;

            TaskQueue.Enqueue(EnterHoldingPattern);
            TaskQueue.Enqueue(WaitForClearance);
            TaskQueue.Enqueue(ApproachEntrance);
            TaskQueue.Enqueue(ApproachDock);
            TaskQueue.Enqueue(FinalAdjustToDock);
            TaskQueue.Enqueue(DockTask);
        }
Пример #2
0
        public DockTaskGenerator(MyGridProgram program, IAutopilot autopilot, IDockingSubsystem ds)
        {
            Program          = program;
            Autopilot        = autopilot;
            DockingSubsystem = ds;

            holdTask     = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.Avoid, DockingSubsystem.Connector);
            approachTask = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.SmartEnter, DockingSubsystem.Connector);
            enterTask    = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.DoNotAvoid, DockingSubsystem.Connector);
            closeTask    = new WaypointTask(Program, Autopilot, new Waypoint(), WaypointTask.AvoidObstacleMode.DoNotAvoid, DockingSubsystem.Connector);
            dockTask     = new DockTask(DockingSubsystem);
            Task         = new MoveToAndDockTask();
            Task.Reset(holdTask, approachTask, enterTask, closeTask, dockTask, MyTuple.Create(IntelItemType.NONE, (long)1234), Program, MyCubeSize.Small, DockingSubsystem.Connector, DockingSubsystem.DirectionIndicator);
            Task.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.FromSeconds(1), null);
            dockTask.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null);
            holdTask.Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null);
            new WaitTask().Do(new Dictionary <MyTuple <IntelItemType, long>, IFleetIntelligence>(), TimeSpan.Zero, null);
        }