private static bool Field(AuthorShared.Content content, ref JointSpring spring, ref bool use) { GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none); AuthorShared.PrefixLabel(content); bool flag = use; bool flag1 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0])); if (flag) { float single = spring.spring; float single1 = spring.targetPosition; float single2 = spring.damper; flag1 = flag1 | AuthorShared.FloatField("Spring Force", ref single, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.FloatField("Target Position", ref single1, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.FloatField("Damper", ref single2, new GUILayoutOption[0]); if (use && flag1) { spring.spring = single; spring.targetPosition = single1; spring.damper = single2; } } AuthorShared.EndVertical(); return(flag1); }
private static bool Field(AuthorShared.Content content, ref JointLimits limits, ref bool use, ref float offset) { GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none); AuthorShared.PrefixLabel(content); bool flag = use; bool flag1 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0])); if (flag) { float single = limits.min; float single1 = limits.max; float single2 = limits.minBounce; float single3 = limits.maxBounce; flag1 = flag1 | AuthorShared.FloatField("Min", ref single, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.FloatField("Max", ref single1, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.FloatField("Min bounciness", ref single2, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.FloatField("Max bounciness", ref single3, new GUILayoutOption[0]); if (use && flag1) { limits.min = single; limits.max = single1; limits.minBounce = single2; limits.maxBounce = single3; } Color color = GUI.contentColor; GUI.contentColor = color * new Color(1f, 1f, 1f, 0.3f); flag1 = flag1 | AuthorShared.FloatField("Offset(visual only)", ref offset, new GUILayoutOption[0]); GUI.contentColor = color; } AuthorShared.EndVertical(); return(flag1); }
private static bool Field(AuthorShared.Content content, ref JointMotor motor, ref bool use) { GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none); AuthorShared.PrefixLabel(content); bool flag = use; bool flag1 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0])); if (flag) { float single = motor.force; float single1 = motor.targetVelocity; bool flag2 = motor.freeSpin; flag1 = flag1 | AuthorShared.FloatField("Force", ref single, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.FloatField("Target Velocity", ref single1, new GUILayoutOption[0]); flag1 = flag1 | AuthorShared.Change(ref flag2, GUILayout.Toggle(flag2, "Free Spin", new GUILayoutOption[0])); if (use && flag1) { motor.force = single; motor.targetVelocity = single1; motor.freeSpin = flag2; } } AuthorShared.EndVertical(); return(flag1); }
private static bool Field(AuthorShared.Content content, ref JointSpring spring, ref bool use) { GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none); AuthorShared.PrefixLabel(content); bool flag = use; bool flag2 = AuthorShared.Change(ref use, GUILayout.Toggle(use, "Use", new GUILayoutOption[0])); if (flag) { float num = spring.spring; float targetPosition = spring.targetPosition; float damper = spring.damper; flag2 |= AuthorShared.FloatField("Spring Force", ref num, new GUILayoutOption[0]); flag2 |= AuthorShared.FloatField("Target Position", ref targetPosition, new GUILayoutOption[0]); flag2 |= AuthorShared.FloatField("Damper", ref damper, new GUILayoutOption[0]); if (use && flag2) { spring.spring = num; spring.targetPosition = targetPosition; spring.damper = damper; } } AuthorShared.EndVertical(); return(flag2); }