Exemple #1
0
 protected LimitCommon(LimitCommonData data)
 {
     this.data = data;
 }
Exemple #2
0
 /// <summary>
 /// Constructs a new limit from the provided properties.
 /// </summary>
 /// <param name="limitData">Cone limit range specific properties.</param>
 /// <param name="commonData">Properties common to all limit types.</param>
 public LimitConeRange(LimitConeRangeData limitData, LimitCommonData commonData)
     : base(commonData)
 {
     this.data = limitData;
 }
Exemple #3
0
 /// <summary>
 /// Constructs a new limit from the provided properties.
 /// </summary>
 /// <param name="limitData">Linear limit specific properties.</param>
 /// <param name="commonData">Properties common to all limit types.</param>
 public LimitLinear(LimitLinearData limitData, LimitCommonData commonData)
     : base(commonData)
 {
     this.data = limitData;
 }
Exemple #4
0
 /// <summary>
 /// Constructs a new limit from the provided properties.
 /// </summary>
 /// <param name="limitData">Linear range specific properties.</param>
 /// <param name="commonData">Properties common to all limit types.</param>
 public LimitLinearRange(LimitLinearRangeData limitData, LimitCommonData commonData)
     : base(commonData)
 {
     this.data = limitData;
 }
Exemple #5
0
 protected LimitCommon(LimitCommonData data)
 {
     this.data = data;
 }
Exemple #6
0
        /// <summary>
        /// Constructs a new set of GUI elements for inspecting the limit object.
        /// </summary>
        /// <param name="prefix">Prefix that identifies the exact type of the limit type.</param>
        /// <param name="limitData">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 LimitCommonGUI(string prefix, LimitCommonData limitData, GUILayout layout, SerializableProperties properties)
        {
            this.limitData = limitData;
            this.properties = properties;
            this.prefix = prefix;

            hardFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_hardLimit_Expanded", x);
                ToggleLimitFields();
            };

            contactDistanceField.OnChanged += x => { this.limitData.contactDist = x; MarkAsModified(); };
            contactDistanceField.OnFocusLost += ConfirmModify;
            contactDistanceField.OnConfirmed += ConfirmModify;

            softFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_softLimit_Expanded", x);
                ToggleLimitFields();
            };

            restitutionField.OnChanged += x => { this.limitData.restitution = x; MarkAsModified(); };
            restitutionField.OnFocusLost += ConfirmModify;

            springFoldout.OnToggled += x =>
            {
                properties.SetBool(prefix + "_spring_Expanded", x);
                ToggleLimitFields();
            };

            hardLimitLayout = layout.AddLayoutX();
            {
                hardLimitLayout.AddSpace(10);

                GUILayoutY hardLimitContentsLayout = hardLimitLayout.AddLayoutY();
                hardLimitContentsLayout.AddElement(contactDistanceField);
            }

            softLimitLayout = layout.AddLayoutX();
            layout.AddElement(softFoldout);
            {
                softLimitLayout.AddSpace(10);

                GUILayoutY softLimitContentsLayout = softLimitLayout.AddLayoutY();
                softLimitContentsLayout.AddElement(restitutionField);
                softLimitContentsLayout.AddElement(springFoldout);
                springLayout = softLimitContentsLayout.AddLayoutX();
                {
                    springLayout.AddSpace(10);

                    GUILayoutY springContentsLayout = springLayout.AddLayoutY();
                    springGUI = new SpringGUI(limitData.spring, springContentsLayout);
                    springGUI.OnChanged += x => { this.limitData.spring = x; MarkAsModified(); };
                    springGUI.OnConfirmed += ConfirmModify;
                }
            }
        }