Example #1
0
    public void ButtonPressed()
    {
        //When the action button scene is pressed, pause, play or reset Rosie according to where she is along the path

        movementRosie rosie = GameObject.Find(current_page).transform.GetChild(0).transform.GetChild(0).gameObject.GetComponent <movementRosie>();

        if (page_active)
        {
            if (rosie.paused)
            {
                if (rosie.dist == 0)
                {
                    playNarration();
                }
                rosie.paused = false;
            }
            else
            {
                if (rosie.path_ended)
                {
                    playNarration();
                    rosie.dist       = 0;
                    rosie.path_ended = false;
                }
                else
                {
                    rosie.paused = true;
                }
            }
        }
    }
Example #2
0
    void Update()
    {
        if (!in_main_menu)
        {
            //Display flickering page icon if not in the menu and a page is not found

            flicker_time = page_active? 0f : flicker_time + Time.deltaTime;
            GameObject.Find("focusOnPage").GetComponent <Image>().enabled = Mathf.Sin(flicker_time * 5f) < 0f;

            if (current_page != "")
            {
                //If on a page, set the scene action button icon depending on where Rosie is along the path, and grey out the icon if the page is not in view

                movementRosie rosie = GameObject.Find(current_page).transform.GetChild(0).transform.GetChild(0).gameObject.GetComponent <movementRosie>();
                if (rosie.paused)
                {
                    button.sprite = page_active ? play_button : play_button_grey;
                }
                else
                {
                    if (rosie.path_ended)
                    {
                        button.sprite = page_active ? replay_button : replay_button_grey;
                    }
                    else
                    {
                        button.sprite = page_active ? pause_button : pause_button_grey;
                    }
                }
            }
        }
    }
Example #3
0
    protected virtual void OnTrackingFound()
    {
        //Setting the light source to be a child of the image target that was found

        GameObject.Find("lightSource").transform.SetParent(transform, false);

        if (!transform.name.Contains("alt"))
        {
            mainController controller_script = GameObject.Find("Controller").GetComponent <mainController>();
            movementRosie  rosie             = transform.GetChild(0).transform.GetChild(0).gameObject.GetComponent <movementRosie>();

            int track_num;

            //Pick correct ambient track for scene

            switch (gameObject.name)
            {
            case "scene2":
                track_num = 3;
                break;

            case "scene3":
                track_num = 2;
                break;

            case "scene4":
                track_num = 1;
                break;

            case "scene6":
                track_num = 0;
                break;

            default:
                track_num = -1;
                break;
            }

            //Play ambient track for scene

            if (track_num > -1)
            {
                GameObject ambience = GameObject.Find("Ambience");
                ambience.GetComponent <AudioSource>().clip = ambience.GetComponent <AmbientSounds>().ambience_list[track_num];
                ambience.GetComponent <AudioSource>().loop = true;
                ambience.GetComponent <AudioSource>().Play();
            }

            //Reset Rosie's position if new page

            rosie.allowed_to_move = true;
            if (controller_script.current_page != gameObject.name)
            {
                rosie.dist       = 0;
                rosie.path_ended = false;
                rosie.paused     = true;
            }
            controller_script.page_active  = true;
            controller_script.current_page = gameObject.name;
        }

        if (mTrackableBehaviour)
        {
            var rendererComponents = mTrackableBehaviour.GetComponentsInChildren <Renderer>(true);
            var colliderComponents = mTrackableBehaviour.GetComponentsInChildren <Collider>(true);
            var canvasComponents   = mTrackableBehaviour.GetComponentsInChildren <Canvas>(true);

            // Enable rendering:
            foreach (var component in rendererComponents)
            {
                component.enabled = true;
            }

            // Enable colliders:
            foreach (var component in colliderComponents)
            {
                component.enabled = true;
            }

            // Enable canvas':
            foreach (var component in canvasComponents)
            {
                component.enabled = true;
            }
        }

        if (OnTargetFound != null)
        {
            OnTargetFound.Invoke();
        }
    }