Beispiel #1
0
        void Start()
        {
            slider = GetComponent <Slider>();
            if (target == null)
            {
                target = slider.GetComponentInChildren <Image>();
            }

            slider.onValueChanged.AddListener(OnValueChanged);
            OnValueChanged(slider.value);
        }
    void Start()
    {
        m_ParticleSystem.Initialize();
        m_Integrator.Initialize(m_ParticleSystem);
        m_IntegratorDropdown = GameObject.Find("IntegratorDropdown").GetComponent <UnityEngine.UI.Dropdown>();
        if (m_Integrator is EulerIntegrator)
        {
            m_IntegratorDropdown.value = 0;
        }
        else if (m_Integrator is MidpointIntegrator)
        {
            m_IntegratorDropdown.value = 1;
        }
        else if (m_Integrator is LeapfrogIntegrator)
        {
            m_IntegratorDropdown.value = 2;
        }
        else if (m_Integrator is RungeKutta4Integrator)
        {
            m_IntegratorDropdown.value = 3;
        }
        else if (m_Integrator is VerletIntegrator)
        {
            m_IntegratorDropdown.value = 4;
        }
        else if (m_Integrator is MidpointVerletIntegrator)
        {
            m_IntegratorDropdown.value = 5;
        }

        m_IntegratorDropdown.RefreshShownValue();

        m_ScenarioDropdown = GameObject.Find("ScenarioDropdown").GetComponent <UnityEngine.UI.Dropdown>();
        if (m_Scenario is TestScenario)
        {
            m_ScenarioDropdown.value = 0;
        }
        else if (m_Scenario is HairScenario)
        {
            m_ScenarioDropdown.value = 1;
        }
        else if (m_Scenario is ClothScenario)
        {
            m_ScenarioDropdown.value = 2;
        }
        else if (m_Scenario is CirclesAndSpringsScenario)
        {
            m_ScenarioDropdown.value = 3;
        }
        else if (m_Scenario is TrainScenario)
        {
            m_ScenarioDropdown.value = 4;
        }
        else if (m_Scenario is PendulumScenario)
        {
            m_ScenarioDropdown.value = 5;
        }
        else if (m_Scenario is DualCircleScenario)
        {
            m_ScenarioDropdown.value = 6;
        }
        else if (m_Scenario is ElipticalEngineScenario)
        {
            m_ScenarioDropdown.value = 7;
        }
        else if (m_Scenario is SlicedEllipseScenario)
        {
            m_ScenarioDropdown.value = 8;
        }
        else if (m_Scenario is ReversibleScenario)
        {
            m_ScenarioDropdown.value = 9;
        }
        else if (m_Scenario is SpeedTestScenario)
        {
            m_ScenarioDropdown.value = 10;
        }
        m_ScenarioDropdown.RefreshShownValue();

        m_CircleDropdown = GameObject.Find("CircleDropdown").GetComponent <UnityEngine.UI.Dropdown>();
        if (CircularWireConstraint.OLD)
        {
            m_CircleDropdown.value = 0;
        }
        else
        {
            m_CircleDropdown.value = 1;
        }

        m_CircleDropdown.RefreshShownValue();

        m_RodDropdown = GameObject.Find("RodDropdown").GetComponent <UnityEngine.UI.Dropdown>();
        if (RodConstraint.OLD)
        {
            m_RodDropdown.value = 0;
        }
        else
        {
            m_RodDropdown.value = 1;
        }

        m_CircleDropdown.RefreshShownValue();

        m_AngleDropdown = GameObject.Find("AngleDropdown").GetComponent <UnityEngine.UI.Dropdown>();
        if (AngularSpringForce.INIT_AD_HOC)
        {
            m_AngleDropdown.value = 0;
        }
        else
        {
            m_AngleDropdown.value = 1;
        }

        m_CircleDropdown.RefreshShownValue();

        m_SolverDropdown       = GameObject.Find("SolverDropdown").GetComponent <UnityEngine.UI.Dropdown>();
        m_SolverDropdown.value = 1; // CG2 default

        m_SimulationFlowToggle = GameObject.Find("ReverseSimulationToggle").GetComponent <UnityEngine.UI.Toggle>();
        m_SpeedSlider          = GameObject.Find("SpeedSlider").GetComponent <UnityEngine.UI.Slider>();
        m_SpeedSliderText      = m_SpeedSlider.GetComponentInChildren <UnityEngine.UI.Text>();
        m_SpeedSlider.value    = Mathf.Clamp(m_Speed, 0.01f, 5f);
        m_SpeedSliderText.text = m_Speed + "x";
    }