예제 #1
0
    void OnButtonPressed(object sender, ButtonXRTriggerEvent e)
    {
        DebugPrint(GetCurrentMethod());
        if (_Enabled)
        {
            _Active = !_Active;

            if (_Active)
            {
                _Base.GetComponent <Renderer>().material.SetColor("_Color", _ColorActive);
                _Base.GetComponent <Renderer>().material.SetColor("_EmissionColor", new Color(_ButtonPressEmissionStrengthRed, _ButtonPressEmissionStrengthGreen, _ButtonPressEmissionStrengthBlue));

                _Text.color = new Color(0f, 0.6f, 0f);// Color.green;
                _Text.GetComponent <Renderer>().material.SetColor("_GlowColor", new Color(0f, 1f, 0f));
            }
            else
            {
                _Base.GetComponent <Renderer>().material.SetColor("_Color", _ColorInactive);
                _Base.GetComponent <Renderer>().material.SetColor("_EmissionColor", new Color(_ButtonPressEmissionStrengthGreen, _ButtonPressEmissionStrengthGreen, _ButtonPressEmissionStrengthGreen));

                _Text.color = new Color(0.5f, 0.5f, 0.5f);// Color.white;
                _Text.GetComponent <Renderer>().material.SetColor("_GlowColor", new Color(1f, 1f, 1f));
            }

            OnToggleEvent?.Invoke(this, new ButtonToggleEvent(this.name, _Active));
        }
    }
예제 #2
0
    void BaseTriggerExitEvent(object sender, ButtonXRTriggerEvent e)
    {
        DebugPrint(GetCurrentMethod());
        if (_Enabled)
        {
            _Text.GetComponent <Renderer>().material.SetFloat("_GlowPower", 0.1f);

            if (_Active)
            {
                _Text.GetComponent <Renderer>().material.SetColor("_GlowColor", new Color(0f, 1f, 0f));
                _Base.GetComponent <Renderer>().material.SetColor("_EmissionColor", new Color(_HoverEmissionStrengthRed, _HoverEmissionStrengthGreen, _HoverEmissionStrengthBlue));
            }
            else
            {
                _Text.GetComponent <Renderer>().material.SetColor("_GlowColor", new Color(1f, 1f, 1f));
                _Base.GetComponent <Renderer>().material.SetColor("_EmissionColor", new Color(_HoverEmissionStrengthGreen, _HoverEmissionStrengthGreen, _HoverEmissionStrengthGreen));
            }
        }
    }