Пример #1
0
 private OperationsManager()
 {
     NumberMissiles = MAX_MISSILES;
     // Set up access to all needed objects
     _target_manager = TargetManager.GetInstance();
     _turret = new MissileLauncherAdapter();
 }
        public void MissileLauncher_Commands_MissileDevice()
        {
            fakeDevice = MockRepository.GenerateMock<IMissileDevice>();
            testLauncher = new LittleNet.UsbMissile.MissileLauncher(fakeDevice);

            CheckCall(l => l.Up(), DeviceCommand.Up);
            CheckCall(l => l.Left(), DeviceCommand.Left);
            CheckCall(l => l.Right(), DeviceCommand.Right);
            CheckCall(l => l.Down(), DeviceCommand.Down);
            CheckCall(l => l.Stop(), DeviceCommand.Stop);
            CheckCall(l => l.Fire(), DeviceCommand.Fire);
        }
Пример #3
0
        public Asml()
        {
            InitializeComponent();

            launcher = new LauncherAdapter();
            threadCamera = new Threads();
            target = new TargetManager();
            control = new Controller();
            stopwatch = new Stopwatch();

            target.AddedTarget +=manager_AddedTarget;
            threadCamera.DataCaptured += new EventHandler<CameraEventArgs>(thread_DataCaptured);
        }
 private void Nod(IMissileLauncher launcher)
 {
     launcher.Down();
     System.Threading.Thread.Sleep(700);
     launcher.Stop();
     launcher.Up();
     System.Threading.Thread.Sleep(500);
     launcher.Stop();
     launcher.Down();
     System.Threading.Thread.Sleep(300);
     launcher.Stop();
     launcher.Up();
     System.Threading.Thread.Sleep(200);
     launcher.Stop();
 }
Пример #5
0
        /// <summary>
        /// Creates a new missile launcher based on what is passed in
        /// </summary>
        /// <param name="type">The type of missile launcher to be created.</param>
        /// <returns>Returns the newly created missile launcher.</returns>
        public static IMissileLauncher CreateMissileLauncher(MLType type)
        {
            IMissileLauncher ML = null;

            switch (type)
            {
            case MLType.DreamCheeky:
                ML = new DreamCheeky();
                break;

            case MLType.Mock:
                ML = new Mock();
                break;
            }
            return(ML);
        }
 private void Shake(IMissileLauncher launcher)
 {
     launcher.Right();
     System.Threading.Thread.Sleep(800);
     launcher.Stop();
     launcher.Left();
     System.Threading.Thread.Sleep(800);
     launcher.Stop();
     launcher.Right();
     System.Threading.Thread.Sleep(800);
     launcher.Stop();
     launcher.Left();
     System.Threading.Thread.Sleep(800);
     launcher.Stop();
     launcher.Right();
     System.Threading.Thread.Sleep(800);
     launcher.Stop();
 }
Пример #7
0
        // Controller depending on the mode, performs the search and destroy using targets data
        public bool Destroy(TargetManager target, IMissileLauncher launcher, ModeType Mode)
        {
            int number_of_lines_per_target = 7;
            int number_of_targets = target.TargetList.Count / number_of_lines_per_target;
            int target_number = 1;

            while (target_number <= number_of_targets && !_shouldStop)
            {
                target.SetTarget(target_number);
                Converter coordinates = new Converter(target.X, target.Y, target.Z);
                switch (Mode)
                {
                    case ModeType.fireAll:
                        if (!_shouldStop)
                            launcher.MoveTo(coordinates.Phi, coordinates.Theta);
                        if (!_shouldStop)
                            launcher.Fire();
                        break;
                    case ModeType.fireFoes:
                        if (!target.Friend)
                        {
                            if (!_shouldStop)
                                launcher.MoveTo(coordinates.Phi, coordinates.Theta);
                            if (!_shouldStop)
                                launcher.Fire();
                        }
                        break;
                    case ModeType.fireFriends:
                        if (target.Friend)
                        {
                            if (!_shouldStop)
                                launcher.MoveTo(coordinates.Phi, coordinates.Theta);
                            if (!_shouldStop)
                                launcher.Fire();
                        }
                        break;
                }
                target_number++;
            }
            return true;
        }
 public override void ExecuteOn(IMissileLauncher launcher)
 {
     launcher.Up();
 }
 public abstract void ExecuteOn(IMissileLauncher launcher);
 public MissileLauncherService(IMissileLauncher launcher)
 {
     this.launcher = launcher;
 }
 public virtual void ExecuteOn(IMissileLauncher launcher)
 {
 }
Пример #12
0
 private void CreateDC()
 {
     m_missileLauncher = MLFactory.CreateMissileLauncher(MLType.DreamCheeky);
     GetCount();
     GetPosition();
 }
Пример #13
0
 private void CreateMock()
 {
     m_missileLauncher = MLFactory.CreateMissileLauncher(MLType.Mock);
     //GetCount();
     //GetPosition();
 }
Пример #14
0
 /// <summary>
 /// Operations Manager constructor.  
 /// </summary>
 private OperationsManager()
 {
     NumberMissiles = MAX_MISSILES;
     // Set up access to all needed objects
     _target_manager = TargetManager.GetInstance();
     _turret = new MissileLauncherAdapter();
     _target_manager.TargetAdded += on_targets_changed;
     _lock = new Object();
     /* we need a way to make these search modes more plug-n-play*/
     _search_modes = new List<string>();
     _search_modes.Add("Foes");
     _search_modes.Add("Friends");
     _search_modes.Add("All");
     _search_mode = new searchfoe();
     _bw = new BackgroundWorker();
     _bw.WorkerSupportsCancellation = true;
     _td = new TargetDetector();
     _td.ImageProcessed += new EventHandler(on_targets_detected);
     _timer = new ThreadedTimer.Timer();
     _timer.TimeCaptured += new EventHandler<TimerEventArgs>(_timer_TimeCaptured);
     TurretReset();
     _visual_target = false;
 }
Пример #15
0
 public bool Reset(IMissileLauncher launcher)
 {
     launcher.Reset();
     return true;
 }
Пример #16
0
 /// <summary>
 /// Operations Manager constructor.  
 /// </summary>
 private OperationsManager()
 {
     NumberMissiles = MAX_MISSILES;
     // Set up access to all needed objects
     _target_manager = TargetManager.GetInstance();
     _turret = new MissileLauncherAdapter();
     _target_manager.TargetAdded += on_targets_changed;
     // this manual reset event helps synchronize between threads.
     _wait_event = new ManualResetEvent(false);
     _lock = new Object();
     //_seach_mode_list.Add(0, "Idle");
     //_seach_mode_list.Add(1, "Foes");
     //_seach_mode_list.Add(2, "Friends");
     //_seach_mode_list.Add(3, "All");
 }
 public CountryDefenseController(IMissileLauncher launcher, string authenticationCode)
 {
     _launcher           = launcher;
     _authenticationCode = authenticationCode;
 }