コード例 #1
0
ファイル: PluckyTheRobot.cs プロジェクト: sycomix/Win10Bot
        /// <summary>
        /// controls exact order in which layers are closed
        /// </summary>
        public override void Close()
        {
            if (!isClosing)
            {
                isClosing = true;

                //joystick.joystickEvent -= Joystick_joystickEvent;

                // first close all higher levels (behaviors), while lower levels are still operational:
                CloseRuntime();

                Debug.WriteLine("PluckyTheRobot: Close() : runtime closed, closing lower levels...");

                // we can now close lower levels which we created. Communication to the board is still open:
                sensorsController.Close();
                driveController.Close();
                //Task.Factory.StartNew(driveController.Close);   // sets PWM to 0
                //Task.Delay(2000).Wait();

                // wait a bit (pumping events) and stop communication with the Hardware Brick (i.e. Element board):
                //CloseCommunication().Wait();

                hardwareBrick.Close();
            }
        }