示例#1
0
    void Start()
    {
        _activityText   = gameObject.GetComponentInChildren <Text>();
        _locationStates = gameObject.GetComponentsInChildren <Image>();

        _picovoiceManager = new PicovoiceManager(_keywordPath, OnWakeWordDetected, _contextPath, OnInferenceResult);
    }
    void Start()
    {
        _voiceProcessor = VoiceProcessor.Instance;
        _voiceProcessor.OnFrameCaptured += AnalyzeMicSignal;

        _videoPlayer = gameObject.GetComponentInChildren<VideoPlayer>();
        
        MeshRenderer[] meshes = gameObject.GetComponentsInChildren<MeshRenderer>();
        _border = meshes.First(x=>x.name == "Border");
        _screenOverlay = meshes.First(x => x.name == "ScreenOverlay");

        Component[] objs = gameObject.GetComponentsInChildren<Component>();
        _timeline = objs.First(x => x.name == "TimelinePivot");        
        _timelineFull = objs.First(x => x.name == "TimelineFullPivot");
        _timeline.transform.localScale = new Vector3(0, 0.2f, 1);
        _timelineFull.transform.localScale = new Vector3(1, 0.2f, 1);

        _volume = objs.First(x => x.name == "VolumePivot");
        _volumeFull = objs.First(x => x.name == "VolumeFullPivot");
        _volume.transform.localScale = new Vector3(1, 0, 1);
        _volumeFull.transform.localScale = new Vector3(1, 0, 1);

        _stateIcons = gameObject.GetComponentsInChildren<SpriteRenderer>().ToDictionary(x => x.name);
        _playbackSpeedText = gameObject.GetComponentsInChildren<TextMeshPro>().First(x=>x.name == "PlaybackSpeed");
        _notificationText = gameObject.GetComponentsInChildren<Text>().First(x => x.name == "NotificationText");
        _notificationText.text = "Say 'Porcupine, what can I say?' for help";
        _notificationPanel = gameObject.GetComponentsInChildren<Image>().First(x => x.name == "NotificationPanel");

        _helpCanvas = gameObject.GetComponentsInChildren<Canvas>().First(x => x.name == "HelpCanvas");        
        _picovoiceManager = new PicovoiceManager(_keywordPath, OnWakeWordDetected, _contextPath, OnInferenceResult);        
        
        StartCoroutine(FadeIntroNotification());
    }
示例#3
0
    void Start()
    {
        _activityText   = gameObject.GetComponentInChildren <Text>();
        _locationStates = gameObject.GetComponentsInChildren <Image>();

        try
        {
            _picovoiceManager = PicovoiceManager.Create(_keywordPath, OnWakeWordDetected, _contextPath, OnInferenceResult);
        }
        catch (Exception ex)
        {
            Debug.LogError("PicovoiceManager was unable to initialize: " + ex.ToString());
        }
    }