Beispiel #1
0
    //TODO: Se não tiver xrFeedback setado, dar um warning de que tu precisa ter um xrFeedback
    //TODO: Criar naughty attributes button pra criar automatico um xrfeedback

    protected virtual void OnValidate()
    {
        xrUIColors = GetComponent <XRUI_Colors>();
        LookForXRFeedback();

        xrFeedback.isEnabled = isEnabled;

        //Check if the uicolor is used with a Feedback Color script. If it's, refresh the normal color on target
        XRUI_FeedbackColor feedbackColor = GetComponentInChildren <XRUI_FeedbackColor>();

        if (feedbackColor != null)
        {
            feedbackColor.RefreshElementColor();
        }
    }
Beispiel #2
0
    private void OnValidate()
    {
        if (target == null)
        {
            target = transform;
        }

        //Check if the uicolor is used with a Feedback Color script. If it's, refresh the normal color on target
        XRUI_FeedbackColor feedbackColor = GetComponentInChildren <XRUI_FeedbackColor>();

        if (feedbackColor != null)
        {
            feedbackColor.RefreshElementColor();
        }
    }
Beispiel #3
0
    private void ConfigureFeedback(ref GameObject go, bool isScale)
    {
        //Set object active to false to don't call the Awake methods of components
        go.SetActive(false);

        XRUI_Colors   xrUIColors   = go.AddComponent <XRUI_Colors>();
        XRUI_Feedback xrUIFeedback = go.AddComponent <XRUI_Feedback>();

        XRUI_FeedbackColor xRUIFeedbackColor = go.AddComponent <XRUI_FeedbackColor>();

        xRUIFeedbackColor.xrUIColors = xrUIColors;

        if (isScale)
        {
            xrUIColors.normalColor = scaleElementColor;
        }
        else
        {
            xrUIColors.normalColor = rotationElementColor;
        }

        xrUIFeedback.nearColliderType   = XRUI_Feedback.NearColliderType.Sphere;
        xrUIFeedback.nearColliderRadius = 0.3f;

        if (feedbackType.Equals("Mesh"))
        {
            xRUIFeedbackColor.feedbackType = XRUI_FeedbackColor.VisualFeedbackType.MeshRenderer;
        }
        else
        {
            xRUIFeedbackColor.feedbackType = XRUI_FeedbackColor.VisualFeedbackType.Outline;
        }

        //after configure all components re-active gameObject so all the awake calls gona occurs
        go.SetActive(true);

        xRUIFeedbackColor.RefreshElementColor();
    }