Beispiel #1
0
        async void ArmDown(object sender, EventArgs e)
        {
            arm.ArmPosReached -= ArmDown;
            _misty.SendDebugMessage("Celebration number " + celebrationCount, null);
            celebrationCount++;
            if (celebrationCount > 3)
            {
                celebrationCount = 0;

                var data = new StringContent("{ \"text\":\"Diamonds!\",\"pitch\":0,\"speechRate\":0,\"voice\":null,\"flush\":false,\"utteranceId\":null }", Encoding.UTF8, "application/json");
                HttpResponseMessage result = await client.PostAsync("http://127.0.0.1/api/tts/speak?text=Ore Found!&pitch=0&speechRate=0&flush=false", data);

                if (tof.GetMinimumDistance() < 0.3)
                {
                    tof.SetFarEnoughThresholdDistance(0.3, false);
                    tof.FarEnough += BackupFromOreBlock;
                    await _misty.MoveArmsAsync(0, -25, null, null, null, AngularUnit.Position);

                    await _misty.DriveAsync(-15, 0);
                }
                else
                {
                    DriveBack();
                }
            }
            else
            {
                await _misty.PlayAudioAsync("MineCraftHit.mp3", 100);

                arm.setTargetArmPos(-25);
                arm.ArmPosReached += ArmUp;
                await _misty.MoveArmsAsync(0, -25, null, null, null, AngularUnit.Position);
            }
        }
Beispiel #2
0
 private async void PlaySoundCallback(object timerData)
 {
     await _misty.PlayAudioAsync("AssetFunSkillFoghorn.mp3", null);
 }