Ejemplo n.º 1
0
    private static bool Field(AuthorShared.Content content, ref SoftJointLimit limits, ref float offset)
    {
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        AuthorShared.PrefixLabel(content);
        float single  = limits.limit;
        float single1 = limits.spring;
        float single2 = limits.damper;
        float single3 = limits.bounciness;
        bool  flag    = AuthorShared.FloatField("Limit", ref single, new GUILayoutOption[0]);

        flag = flag | AuthorShared.FloatField("Spring", ref single1, new GUILayoutOption[0]);
        flag = flag | AuthorShared.FloatField("Damper", ref single2, new GUILayoutOption[0]);
        flag = flag | AuthorShared.FloatField("Bounciness", ref single3, new GUILayoutOption[0]);
        if (flag)
        {
            limits.limit      = single;
            limits.spring     = single1;
            limits.damper     = single2;
            limits.bounciness = single3;
        }
        Color color = GUI.contentColor;

        GUI.contentColor = color * new Color(1f, 1f, 1f, 0.3f);
        flag             = flag | AuthorShared.FloatField("Offset(visual only)", ref offset, new GUILayoutOption[0]);
        GUI.contentColor = color;
        AuthorShared.EndVertical();
        return(flag);
    }
Ejemplo n.º 2
0
    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);
    }
Ejemplo n.º 3
0
    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);
    }
Ejemplo n.º 4
0
    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);
    }
Ejemplo n.º 5
0
    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);
    }
Ejemplo n.º 6
0
    public override bool PeiceInspectorGUI()
    {
        bool   flag = base.PeiceInspectorGUI();
        string str  = base.peiceID;

        if (AuthorShared.StringField("Title", ref str, new GUILayoutOption[0]))
        {
            base.peiceID = str;
            flag         = true;
        }
        AuthorShared.EnumField("Kind", this.kind, new GUILayoutOption[0]);
        AuthorShared.PrefixLabel("Self");
        if (GUILayout.Button(AuthorShared.ObjectContent <AuthorChHit>(this.self, typeof(AuthorChHit)), new GUILayoutOption[0]))
        {
            AuthorShared.PingObject(this.self);
        }
        flag = flag | AuthorShared.PeiceField <AuthorChHit>("Connected", this, ref this.connect, typeof(AuthorChHit), GUI.skin.button, new GUILayoutOption[0]);
        flag = flag | AuthorShared.Toggle("Reverse Link", ref this.reverseLink, new GUILayoutOption[0]);
        flag = flag | AuthorShared.Vector3Field("Anchor", ref this.anchor, new GUILayoutOption[0]);
        flag = flag | AuthorShared.Vector3Field("Axis", ref this.axis, new GUILayoutOption[0]);
        AuthorChJoint.Kind kind = this.kind;
        if (kind == AuthorChJoint.Kind.Hinge)
        {
            JointLimits jointLimit = this.limit;
            if (AuthorChJoint.Field("Limits", ref jointLimit, ref this.useLimit, ref this.limitOffset))
            {
                flag       = true;
                this.limit = jointLimit;
            }
        }
        else if (kind == AuthorChJoint.Kind.Character)
        {
            flag = flag | AuthorShared.Vector3Field("Swing Axis", ref this.swingAxis, new GUILayoutOption[0]);
            SoftJointLimit softJointLimit = this.lowTwist;
            if (AuthorChJoint.Field("Low Twist", ref softJointLimit, ref this.twistOffset))
            {
                flag          = true;
                this.lowTwist = softJointLimit;
            }
            softJointLimit = this.highTwist;
            if (AuthorChJoint.Field("High Twist", ref softJointLimit, ref this.twistOffset))
            {
                flag           = true;
                this.highTwist = softJointLimit;
            }
            softJointLimit = this.swing1;
            if (AuthorChJoint.Field("Swing 1", ref softJointLimit, ref this.swingOffset1))
            {
                flag        = true;
                this.swing1 = softJointLimit;
            }
            softJointLimit = this.swing2;
            if (AuthorChJoint.Field("Swing 2", ref softJointLimit, ref this.swingOffset2))
            {
                flag        = true;
                this.swing2 = softJointLimit;
            }
        }
        flag = flag | AuthorShared.FloatField("Break Force", ref this.breakForce, new GUILayoutOption[0]);
        flag = flag | AuthorShared.FloatField("Break Torque", ref this.breakTorque, new GUILayoutOption[0]);
        return(flag);
    }
Ejemplo n.º 7
0
    public override bool PeiceInspectorGUI()
    {
        bool   flag    = base.PeiceInspectorGUI();
        string peiceID = base.peiceID;

        if (AuthorShared.StringField("Title", ref peiceID, new GUILayoutOption[0]))
        {
            base.peiceID = peiceID;
            flag         = true;
        }
        AuthorShared.EnumField("Kind", this.kind, new GUILayoutOption[0]);
        AuthorShared.PrefixLabel("Self");
        if (GUILayout.Button((GUIContent)AuthorShared.ObjectContent <AuthorChHit>(this.self, typeof(AuthorChHit)), new GUILayoutOption[0]))
        {
            AuthorShared.PingObject(this.self);
        }
        flag |= AuthorShared.PeiceField <AuthorChHit>("Connected", this, ref this.connect, typeof(AuthorChHit), GUI.skin.button, new GUILayoutOption[0]);
        flag |= AuthorShared.Toggle("Reverse Link", ref this.reverseLink, new GUILayoutOption[0]);
        flag |= AuthorShared.Vector3Field("Anchor", ref this.anchor, new GUILayoutOption[0]);
        flag |= AuthorShared.Vector3Field("Axis", ref this.axis, new GUILayoutOption[0]);
        switch (this.kind)
        {
        case Kind.Hinge:
        {
            JointLimits limits = this.limit;
            if (Field("Limits", ref limits, ref this.useLimit, ref this.limitOffset))
            {
                flag       = true;
                this.limit = limits;
            }
            break;
        }

        case Kind.Character:
        {
            flag |= AuthorShared.Vector3Field("Swing Axis", ref this.swingAxis, new GUILayoutOption[0]);
            SoftJointLimit lowTwist = this.lowTwist;
            if (Field("Low Twist", ref lowTwist, ref this.twistOffset))
            {
                flag          = true;
                this.lowTwist = lowTwist;
            }
            lowTwist = this.highTwist;
            if (Field("High Twist", ref lowTwist, ref this.twistOffset))
            {
                flag           = true;
                this.highTwist = lowTwist;
            }
            lowTwist = this.swing1;
            if (Field("Swing 1", ref lowTwist, ref this.swingOffset1))
            {
                flag        = true;
                this.swing1 = lowTwist;
            }
            lowTwist = this.swing2;
            if (Field("Swing 2", ref lowTwist, ref this.swingOffset2))
            {
                flag        = true;
                this.swing2 = lowTwist;
            }
            break;
        }
        }
        flag |= AuthorShared.FloatField("Break Force", ref this.breakForce, new GUILayoutOption[0]);
        return(flag | AuthorShared.FloatField("Break Torque", ref this.breakTorque, new GUILayoutOption[0]));
    }