示例#1
0
    // Update is called once per frame
    void Update()
    {
        // Detect and handle pause via key press (for testing)
        if (Input.GetKeyDown(KeyCode.P))
        {
            if (Time.timeScale == 1)
            {
                Time.timeScale = 0;
                showPaused();
            }
            else if (Time.timeScale == 0)
            {
                Time.timeScale = 1;
                hidePaused();
            }
        }


        // Update UI if phase has changed
        // For some reason, it doesn't seem to work to put the following two lines in Start(), they seem to need to be redone here


        //GameObject gameManager = transform.gameObject;
        VisibilityControllerScriptWithModes visibilityControllerScript = GetComponent <VisibilityControllerScriptWithModes>();

        //VisibilityControllerScript visibilityControllerScript= segConObj.GetComponent<VisibilityControllerScript>();
        if (visibilityControllerScript.currentFrameIndex != currentFrameIndex)
        {
            currentFrameIndex = visibilityControllerScript.currentFrameIndex;
            updateFrameSlider();
            updateFrameText();
        }
    }
示例#2
0
    void RegionCheckboxChanged()
    {
        // Scan checkbox boolean values and apply them to _vis flags in visibility controller script

        VisibilityControllerScriptWithModes visibilityControllerScript = GetComponent <VisibilityControllerScriptWithModes>();


        for (int ind = 0; ind < regionToggleObjs.Length; ind++)
        {
            // Find the corresponding visibility boolean flag and set it to match
            GameObject curToggleObj     = regionToggleObjs[ind];
            Toggle     ToggleComponent  = curToggleObj.GetComponent <Toggle>();
            bool       isChecked        = ToggleComponent.isOn;
            string     regionToggleName = curToggleObj.name;

            // Set the matching visibiility flag
            // NB: This is incredibily clunky and badly fragile, but it is the only easy way to structure it that I
            // can figure out right now.  Ideally, there would be a much better way to ensure conformance between the
            // checkbox being clicked and the visibility flag being set.  This method relies on a a fixed, hard-coded
            // ordering of the regions, as well as hard-coded names for the regions.  This should most certainly be
            // refactored later!!!  TODO
            // TODO TODO TODO!!
            // Update: Slightly better now, at least relies on name matching between name of toggle and visibility field name
            switch (regionToggleName)
            {
            case "ToggleLA":
                visibilityControllerScript.LA_vis = isChecked;
                break;

            case "ToggleLV":
                visibilityControllerScript.LV_vis = isChecked;
                break;

            case "ToggleAorta":
                visibilityControllerScript.Ao_vis = isChecked;
                break;

            case "ToggleRA":
                visibilityControllerScript.RA_vis = isChecked;
                break;

            case "ToggleRV":
                visibilityControllerScript.RV_vis = isChecked;
                break;

            case "TogglePA":
                visibilityControllerScript.PA_vis = isChecked;
                break;

            default:
                Debug.LogError("Did not match a case in region flag checking!");
                break;
            }
        }
        // Trigger visibility update even if animation is currently paused
        visibilityControllerScript.ChangeCurrentFrameIndex(currentFrameIndex);
    }
示例#3
0
    void SliderValueChanged()
    {
        // Force user change of slider value to change the displayed phase
        int currentFrameIndex = (int)frameSlider.value;

        VisibilityControllerScriptWithModes visibilityControllerScript = GetComponent <VisibilityControllerScriptWithModes>();

        visibilityControllerScript.ChangeCurrentFrameIndex(currentFrameIndex);
    }
示例#4
0
    void ModeChangeTap()
    {
        // User tapped mode button
        currentMode = (currentMode + 1) % 3; // increment current mode
        Sprite newSpriteToChangeTo = modeSprites[currentMode];

        modeButton.GetComponent <Button>().GetComponent <Image>().sprite = newSpriteToChangeTo;

        // Also need to update the display!
        VisibilityControllerScriptWithModes visibilityControllerScript = GetComponent <VisibilityControllerScriptWithModes>();

        visibilityControllerScript.UpdateBecauseOfModeChange();
    }