示例#1
0
        /// <inheritdoc/>
        public override bool Equals(object rhs)
        {
            if (rhs is LimitLinearRange)
            {
                LimitLinearRange other = (LimitLinearRange)rhs;
                return(base.Equals(rhs) && Lower == other.Lower && Upper == other.Upper);
            }

            return(false);
        }
        /// <summary>Initializes the struct with default values.</summary>
        public static LimitLinearRange Default()
        {
            LimitLinearRange value = new LimitLinearRange();

            value.lower       = 0f;
            value.upper       = 0f;
            value.contactDist = -1f;
            value.restitution = 0f;
            value.spring      = new Spring();

            return(value);
        }
 private static extern void Internal_SetLimit(IntPtr thisPtr, LimitLinearRange limit);
 private static extern void Internal_getLimit(IntPtr thisPtr, out LimitLinearRange __output);
 private static extern void Internal_SetLimit(IntPtr thisPtr, LimitLinearRange limit);
示例#6
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="limit">Initial values to assign to the GUI elements.</param>
        /// <param name="layout">Layout to append the GUI elements to.</param>
        /// <param name="properties">A set of properties that are persisted by the parent inspector. Used for saving state.
        ///                          </param>
        public LimitLinearRangeGUI(LimitLinearRange limit, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limit.Data;

            limitLowerField.OnChanged += x => { limitData.lower = x; MarkAsModified(); };
            limitLowerField.OnFocusLost += ConfirmModify;

            limitUpperField.OnChanged += x => { limitData.upper = x; MarkAsModified(); };
            limitUpperField.OnFocusLost += ConfirmModify;

            layout.AddElement(limitLowerField);
            layout.AddElement(limitUpperField);
            limitCommonGUI = new LimitCommonGUI("linearRange", limit.CommonData, layout, properties);
            limitCommonGUI.OnChanged += x => MarkAsModified();
            limitCommonGUI.OnConfirmed += ConfirmModify;
        }