Esempio n. 1
0
        private void Ewww()
        {
            int soundNumber = _random.Next(1, 5);

            switch (soundNumber)
            {
            case 1:
                _misty.PlayAudio("Fart-Common-Everyday-Fart_Mike-Koenig.wav", null, null);
                _assetWrapper.ShowSystemImage(SystemImage.Surprise);
                _misty.Wait(2000);
                _assetWrapper.PlaySystemSound(SystemSound.PhraseOopsy);
                break;

            case 2:
                _misty.PlayAudio("Quick Fart-SoundBible.com-655578646.wav", null, null);
                _assetWrapper.ShowSystemImage(SystemImage.JoyGoofy2);
                break;

            case 3:
                _misty.PlayAudio("Silly_Farts-Joe-1473367952.wav", null, null);
                _assetWrapper.ShowSystemImage(SystemImage.TerrorRight);
                _misty.Wait(3000);
                _assetWrapper.PlaySystemSound(SystemSound.PhraseUhOh);
                break;

            case 4:
                _misty.PlayAudio("Belch-Kevan-136688254.wav", null, null);
                _assetWrapper.ShowSystemImage(SystemImage.Disgust);
                _misty.Wait(3000);
                break;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// This event handler is called when the robot/user sends a start message
        /// The parameters can be set in the Skill Runner (or as json) and used in the skill if desired
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="parameters"></param>
        public async void OnStart(object sender, IDictionary <string, object> parameters)
        {
            try
            {
                await InitializeSkill();
                await ProcessStartupParameters(parameters);
                await ProcessAdjustableParameters(parameters);

                _misty.ChangeLED(255, 0, 0, null);
                if (!_misty.Wait(0))
                {
                    return;
                }

                //Spanish translations
                List <BumpSensorValidation> backLeftBumpValidations = new List <BumpSensorValidation>();
                backLeftBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.SensorName, ComparisonOperator.Equal, BumpSensorPosition.BackLeft));
                backLeftBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.IsContacted, ComparisonOperator.Equal, true));
                _misty.RegisterBumpSensorEvent(ProcessBackLeftBumpEvent, 250, true, backLeftBumpValidations, null, null);

                //Face Rec on/off toggle
                List <BumpSensorValidation> backRightBumpValidations = new List <BumpSensorValidation>();
                backRightBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.SensorName, ComparisonOperator.Equal, BumpSensorPosition.BackRight));
                backRightBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.IsContacted, ComparisonOperator.Equal, true));
                _misty.RegisterBumpSensorEvent(ProcessBackRightBumpEvent, 250, true, backRightBumpValidations, null, null);

                //Picture description
                List <BumpSensorValidation> frontRightBumpValidations = new List <BumpSensorValidation>();
                frontRightBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.SensorName, ComparisonOperator.Equal, BumpSensorPosition.FrontRight));
                frontRightBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.IsContacted, ComparisonOperator.Equal, true));
                _misty.RegisterBumpSensorEvent(ProcessFrontRightBumpEvent, 250, true, frontRightBumpValidations, null, null);

                //Repeat
                List <BumpSensorValidation> frontLeftBumpValidations = new List <BumpSensorValidation>();
                frontLeftBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.SensorName, ComparisonOperator.Equal, BumpSensorPosition.FrontLeft));
                frontLeftBumpValidations.Add(new BumpSensorValidation(BumpSensorFilter.IsContacted, ComparisonOperator.Equal, true));
                _misty.RegisterBumpSensorEvent(ProcessFrontLeftBumpEvent, 250, true, frontLeftBumpValidations, null, null);

                RegisterUserEvents();

                if (!_misty.Wait(2000))
                {
                    return;
                }

                //All ready to go
                _assetWrapper.PlaySystemSound(SystemSound.Amazement);
                _assetWrapper.ShowSystemImage(SystemImage.EcstacyStarryEyed);
                _misty.ChangeLED(0, 0, 255, null);

                if (!_misty.Wait(1500))
                {
                    return;
                }

                BroadcastDetails("Hello!  How are you?", _defaultVoice);
                await _misty.TransitionLEDAsync(255, 0, 0, 0, 0, 255, LEDTransition.Breathe, 500);

                _misty.Wait(1500);
                await _misty.TransitionLEDAsync(0, 0, 255, 255, 140, 0, LEDTransition.Breathe, 1000);

                /*
                 * //Test code to describe a random image at this URL
                 * BroadcastDetails("Describing random image.");
                 * _misty.Wait(500);
                 * string description = await _azureCognitive.AnalyzeImage("http://junglebiscuit.com/images/random/rand_image.pl");
                 * BroadcastDetails(description);
                 */
            }
            catch (Exception ex)
            {
                _misty.SkillLogger.Log("Failed while starting the skill.", ex);
            }
        }