Example #1
0
    // Use this for initialization
    void Start()
    {
        //if (IsVoiceOverOn.isVoiceOverOn()) {
        am = gameObject.AddComponent <AccessibilityMode> () as AccessibilityMode;
        //am = GetComponent<AccessibilityMode>();
        am.border = border;

        accessibility.setAccessibility(true);


        NarratableObject[] sceneObjects = new NarratableObject[sceneComponents.Count];
        for (int i = 0; i < sceneComponents.Count; i++)
        {
            sceneObjects[i].component = sceneComponents[i];
            sceneObjects[i].waitTime  = waitTimes[i];
        }

        am.runAccessibilityMode(sceneObjects);
        //}
    }
Example #2
0
    private IEnumerator run(NarratableObject[] sceneObjects)
    {
        while (!IsVoiceOverOn.isVoiceOverOn())
        {
            yield return(null);
        }

        disableSceneComponents(sceneObjects);
        while (true)
        {
            if (!IsVoiceOverOn.isVoiceOverOn())
            {
                enableSceneComponents(sceneObjects);
            }

            while (!IsVoiceOverOn.isVoiceOverOn())
            {
                yield return(null);
            }

            int currentIndex = 0;
            while (currentIndex < sceneObjects.Length)
            {
                if (!IsVoiceOverOn.isVoiceOverOn())
                {
                    break;
                }
                else
                {
                    disableSceneComponents(sceneObjects);
                }

                NarratableObject narratableObject = sceneObjects[currentIndex];

                currentComponent = narratableObject.component;
                float waitTime = narratableObject.waitTime;

                Text description = currentComponent.GetComponentInChildren <Text>();

                enableComponent(narratableObject.component);

                if (description != null)
                {
                    EasyTTSUtil.SpeechAdd(description.text, VOLUME, RATE, PITCH);
                }
                else
                {
                    Debug.Log("Accessibility Mode given an object with no text.");
                }

                float t = 0.0f;
                while (t <= waitTime && (!swipeLeft && !swipeRight) && IsVoiceOverOn.isVoiceOverOn())
                {
                    t += Time.deltaTime;
                    yield return(null);
                }

                if (loop || (swipeLeft || swipeRight) || !IsVoiceOverOn.isVoiceOverOn())
                {
                    disableComponent(narratableObject.component);
                }

                currentIndex = updateIndex(currentIndex, sceneObjects.Length);
            }
        }
    }