示例#1
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);
    }
示例#2
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);
    }