Esempio n. 1
0
        // Script initialization

        void Awake()
        {
            delftSettings = Resources.Load <Settings>("DelftAIToolkitSettings");
            foreach (Settings.WatsonService service in delftSettings.watsonServices)
            {
                //print("Virt " + thisDevice + ": Loading Watson Service Credentials: " + service.service.ToString());
                watsonCredentials.Add(service.service, service);
            }
            foreach (Settings.Ding dingNetwork in delftSettings.dings)
            {
                if (dingNetwork.device == thisDevice)
                {
                    //print("Virt " + thisDevice + ": Loading Marionnette Network Settings: " + dingNetwork.device.ToString());
                    MarionetteIPAddr = dingNetwork.marionetteIP;
                    OutgoingPort     = dingNetwork.marionetteOutPort;
                    IncomingPort     = dingNetwork.marionetteInPort;
                }
            }

            // OSC
            if (MarionetteIPAddr != "127.0.0.1")
            {
                serverClientID = OSC_SERVER_CLIENT + MarionetteIPAddr + IncomingPort;
                OSCHandler.Instance.Init(serverClientID, MarionetteIPAddr, OutgoingPort, IncomingPort);
                servers = new Dictionary <string, ServerLog>();
                clients = new Dictionary <string, ClientLog>();
                OSCInit = true;
            }

            // Watson Speech to Text
            if (watsonCredentials[AiGlobals.WatsonServices.speechToText].iamKey != "")
            {
                print(thisDevice + ": Initializing Virtual Watson Speech To Text...");
                stt = gameObject.AddComponent <WatsonSTT>();
                stt.StartService(sttResults, watsonCredentials[AiGlobals.WatsonServices.speechToText].iamKey);
            }             // else print("Need IamKey to start Watson Speech To Text - See Assets>Resources>DelftAITookitSettings");

            // Watson Text to Speech
            if (watsonCredentials[AiGlobals.WatsonServices.textToSpeech].iamKey != "")
            {
                print(thisDevice + ": Initializing Virtual Watson Text to Speech...");
                tts = gameObject.AddComponent <WatsonTTS>();
                tts.StartService(ttsResults, watsonCredentials[AiGlobals.WatsonServices.textToSpeech].iamKey,
                                 watsonCredentials[AiGlobals.WatsonServices.textToSpeech].url);
            }             // else print("Need IamKey to start Watson Text to Speech - See Assets>Resources>DelftAITookitSettings");

            // Watson Assistant
            //if (watsonCredentials[AiGlobals.WatsonServices.assistant].iamKey != "") {
            //	print(thisDevice + ": Initializing Virtual Watson Assistant...");
            //	assistant = gameObject.AddComponent<WatsonAssistantV2>();
            //	assistant.StartService(assistantResults(), watsonCredentials[AiGlobals.WatsonServices.assistant].iamKey,watsonCredentials[AiGlobals.WatsonServices.assistant].assistantid,
            //	watsonCredentials[AiGlobals.WatsonServices.textToSpeech].url);
            //	assistant.message("what is machine learning?");
            //} // else print("Need IamKey to start Watson Text to Speech - See Assets>Resources>DelftAITookitSettings");

            // yawTarget = yawJoint.localEulerAngles.z;
            // pitchTarget = pitchJoint.localEulerAngles.y;
            allKeyCodes = System.Enum.GetValues(typeof(KeyCode));
        }