Пример #1
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(SphereCollider collider)
        {
            if (!centerField.HasInputFocus)
                centerField.Value = collider.Center;

            if (!radiusField.HasInputFocus)
                radiusField.Value = collider.Radius;

            base.Refresh(collider);
        }
Пример #2
0
        /// <summary>
        /// Creates GUI elements for fields specific to the sphere collider.
        /// </summary>
        protected void BuildGUI(SphereCollider collider)
        {
            centerField.OnChanged += x => { collider.Center = x; MarkAsModified(); };
            centerField.OnFocusLost += ConfirmModify;
            centerField.OnConfirmed += ConfirmModify;

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

            Layout.AddElement(centerField);
            Layout.AddElement(radiusField);

            base.BuildGUI(collider);
        }