Exemplo n.º 1
0
        /// <summary>
        /// Creates GUI elements for fields specific to the plane collider.
        /// </summary>
        protected void BuildGUI(PlaneCollider collider)
        {
            normalField.OnChanged += x =>
            {
                normal = x;
                collider.Normal = x;

                MarkAsModified();
            };
            normalField.OnFocusLost += ConfirmModify;
            normalField.OnConfirmed += ConfirmModify;

            distanceField.OnChanged += x => { collider.Distance = x; MarkAsModified(); };
            distanceField.OnFocusLost += ConfirmModify;
            distanceField.OnConfirmed += ConfirmModify;

            Layout.AddElement(normalField);
            Layout.AddElement(distanceField);

            normal = collider.Normal;

            base.BuildGUI(collider);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Updates all GUI elements from current values in the collider.
        /// </summary>
        /// <param name="collider">Collider to update the GUI from.</param>
        protected void Refresh(PlaneCollider collider)
        {
            if (!normalField.HasInputFocus)
                normalField.Value = normal;

            if (!distanceField.HasInputFocus)
                distanceField.Value = collider.Distance;

            base.Refresh(collider);
        }