Esempio n. 1
0
    private void Refresh()
    {
        //if (m_RulerDisplayType == Units.Type.Metric) {
        //    m_RulerName = Units.RulerName( m_MetricRulerUnit );
        //} else {
        //    m_RulerName = Units.RulerName( m_StandardRulerUnit );
        //}

        m_RulerUnit = (m_RulerDisplayType == Units.Type.Metric) ? m_MetricRulerUnit : m_StandardRulerUnit;
    }
Esempio n. 2
0
    /// <summary>
    /// Expected value in Meters
    /// </summary>
    public void Set(float val, bool sendCallback)
    {
        Units.RulerUnit fromUnit = Units.RulerUnit.Meters;
        if (m_RulerDisplayType == Units.Type.Standard)
        {
            fromUnit = Units.RulerUnit.Feet;
            val      = val * Units.k_MToFt;
        }
        m_Value = Units.Convert(m_RulerDisplayType, fromUnit, m_RulerUnit, val);

        rulerSlider.SetValue(m_Value, false);

        if (sendCallback)
        {
            m_OnValueChanged.Invoke(Get());
        }

        m_VisualsDirty = true;
    }
Esempio n. 3
0
    /// <summary>
    /// Set the Range, Increment & Decrement button deltas, the Description, and the Unit Text (e.g. in or cm)
    /// </summary>
    public void Setup(float min, float max, float bigIncDec, float smallIncDec, string description, Units.RulerUnit unit)
    {
        // Button Listeners
        incBigBtn.onClick.RemoveAllListeners();
        incSmallBtn.onClick.RemoveAllListeners();
        decBigBtn.onClick.RemoveAllListeners();
        decSmallBtn.onClick.RemoveAllListeners();

        incBigBtn.onClick.AddListener(() => { Adjust(bigIncDec); });
        incSmallBtn.onClick.AddListener(() => { Adjust(smallIncDec); });
        decBigBtn.onClick.AddListener(() => { Adjust(-bigIncDec); });
        decSmallBtn.onClick.AddListener(() => { Adjust(-smallIncDec); });

        // Range
        m_minValue = min;
        m_maxValue = max;

        m_unit = unit;

        // Description & Unit Text
        descriptionText.text = description;
        unitText.text        = Units.k_UnitAbbreviations[(int)unit];
    }
Esempio n. 4
0
    void Awake()
    {
        // Defaults
        unitType        = Units.Type.Standard;
        outputRulerUnit = Units.RulerUnit.Feet;

        // Ensure one instance of this
        if (engine == null)
        {
            DontDestroyOnLoad(this);
            engine = this;
        }
        else if (engine != this)
        {
            Destroy(this);
        }

        // Limit Frame Rate
        Application.targetFrameRate = 10;


        // Get References
        GameObject found = GameObject.FindWithTag("ScreenManager");

        if (found != null)
        {
            screenManager = found.GetComponent <ScreenManager>();
        }
        found = GameObject.FindWithTag("EventManager");
        if (found != null)
        {
            eventManager = found.GetComponent <EventManager>();
        }
        found = GameObject.FindWithTag("ConduitManager");
        if (found != null)
        {
            conduitManager   = found.GetComponent <ConduitManager>();
            conduitGenerator = found.GetComponent <ConduitGenerator>();
        }
        GameObject[] foundarr = GameObject.FindGameObjectsWithTag("MainCamera");
        if (foundarr.Length != 0)
        {
            for (int i = 0; i < foundarr.Length; ++i)
            {
                if (mainCameraController = foundarr[i].GetComponent <CameraController>())
                {
                    break;
                }
            }
        }
        mainCameraController.movementEnabled = false;

        root_ui        = GameObject.Find("_UI").transform;
        root_geometry  = GameObject.Find("_Geometry").transform;
        root_conduit   = GameObject.Find("_Conduit").transform;
        root_particles = GameObject.Find("_Particles").transform;
        root_flag      = GameObject.Find("_Flag").transform;

        cameraUI   = GameObject.FindWithTag("UICamera").GetComponent <Camera>();
        cameraMain = GameObject.FindWithTag("MainCamera").GetComponent <Camera>();

#if UNITY_EDITOR
        // Check Nulls
        if (screenManager == null)
        {
            Debug.LogError("Engine: Initialize() No Screen Manager found in scene with the tag 'SceneManager'.");
            return;
        }
        if (eventManager == null)
        {
            Debug.LogError("Engine: Initialize() No Event Manager found in scene on object with the tag 'EventManager'.");
            return;
        }
        if (conduitManager == null)
        {
            Debug.LogError("Engine: Initialize() No Conduit Manager found in scene on object with the tag 'ConduitManager'.");
            return;
        }
        if (conduitGenerator == null)
        {
            Debug.LogError("Engine: Initialize() No Conduit Generator found in scene on object with the tag 'ConduitManager'.");
            return;
        }
        if (mainCameraController == null)
        {
            Debug.LogError("Engine: Initialize() No Main Camera Controller found in scene on object with the tag 'MainCamera'.");
            return;
        }
#endif

        //DebugToScreen.Log( "Engine: Initialize() Awake Complete!" );
    }