示例#1
0
    // Start function
    void Start()
    {
        // If initialization is incomplete
        if (GameObject.Find("PermanentObjects") == null)
        {
            SceneManager.LoadScene("sc0_pom");
            return;
        }

        pom           = GameObject.Find("PermanentObjects").GetComponent <PermanentObjectsManager> ();
        cameraManager = GameObject.Find("Camera").GetComponent <CameraManager> ();
        grapher       = GameObject.Find("Grapher").transform;
        drawingCanvas = GameObject.Find("DrawingCanvas").GetComponentsInChildren <Transform>()[1];
        drawingArea   = drawingCanvas.GetComponentsInChildren <Transform>()[1];

        foreach (Transform child in drawingArea)
        {
            if (child.name == "Background")
            {
                background = child;
            }
            if (child.name == "Content")
            {
                content = child;
                foreach (Transform subchild in child)
                {
                    if (subchild.name == "Parameters")
                    {
                        parameters = subchild;
                    }
                    if (subchild.name == "Graphics")
                    {
                        graphics = subchild;
                    }
                    if (subchild.name == "Navigation")
                    {
                        navigation = subchild;
                    }
                }
            }
        }

        grapherManager = grapher.gameObject.GetComponent <GraphManager> ();
        foreach (Transform child in parameters)
        {
            if (child.name == "Dim1")
            {
                dim1SliderManager = child.GetComponent <SliderManager> ();
            }
            if (child.name == "Dim2")
            {
                dim2SliderManager = child.GetComponent <SliderManager> ();
            }
        }
        foreach (Transform child in graphics)
        {
            if (child.name == "Resolution")
            {
                resolutionSSBSManager = child.GetComponent <SliderSBSManager> ();
            }
            if (child.name == "ExtraGraphics")
            {
                foreach (Transform subchild in child)
                {
                    if (subchild.name == "ActivateRotation")
                    {
                        activateRotationToggle = subchild.GetComponentsInChildren <Transform> () [1]
                                                 .GetComponentsInChildren <Text> () [0];
                    }
                    if (subchild.name == "FullGraphics")
                    {
                        fullGraphicsToggle = subchild.GetComponentsInChildren <Transform> () [1]
                                             .GetComponentsInChildren <Text> () [0];
                    }
                }
            }
        }
        foreach (Transform child in navigation)
        {
            if (child.name == "Dim1")
            {
                dim1StateDropdown = child.GetComponent <Dropdown> ();
            }
            if (child.name == "Dim2")
            {
                dim2StateDropdown = child.GetComponent <Dropdown> ();
            }
        }

        dataHandler = pom.data;
        Dimension[] dims = dataHandler.state.dimensions;
        grapherManager.Initialize(dataHandler, pom.function);

        cameraManager.Initialize(dataHandler);
        dim1SliderManager.Initialize(dims[2]);
        dim2SliderManager.Initialize(dims[3]);
        resolutionSSBSManager.Initialize(pom.function != Formula.Function.None);
        resolutionSSBSManager.UpdateName(dims[0].GetRes() + " x " + dims[1].GetRes());

        interaction = new Interaction(Interaction.InteractionType.Mouse);
        if (pom.interaction3D)
        {
            interaction = new Interaction(Interaction.InteractionType.Mouse3D);
        }
        transition = new Transition();

        UpdateCheckboxes();
        UpdateNavigationDropdowns(dims);
        currentlyMovingCamera = false;
        staticCall            = false;

        grapherManager.pointsValues = grapherManager.createPointsFrom(dataHandler.state);
        grapherManager.DrawPoints(grapherManager.pointsValues);

        int[] orders = dataHandler.state.current.Value;
    }