Пример #1
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);
    }
Пример #2
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);
    }
Пример #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);
    }
Пример #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);
    }
Пример #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);
    }
Пример #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);
    }
Пример #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]));
    }
Пример #8
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;
        }
        bool     flag1    = (!this.mirrored ? false : this.mirrored != this.bone);
        bool     flag2    = this.bone;
        BodyPart bodyPart = this.bodyPart;

        if (AuthorShared.ObjectField <Transform>("Bone", ref this.bone, AuthorShared.ObjectFieldFlags.AllowScene | AuthorShared.ObjectFieldFlags.Model | AuthorShared.ObjectFieldFlags.Instance, new GUILayoutOption[0]))
        {
            if (!flag2)
            {
                this.FigureOutDefaultBodyPart(this.bone, ref bodyPart);
            }
            flag = true;
        }
        BodyPart bodyPart1 = this.mirroredBodyPart;

        if (flag2)
        {
            bodyPart = (BodyPart)AuthorShared.EnumField("Body Part", bodyPart, new GUILayoutOption[0]);
        }
        GUI.Box(AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        flag = flag | AuthorShared.ObjectField <Transform>("Mirrored Bone", ref this.mirrored, AuthorShared.ObjectFieldFlags.AllowScene | AuthorShared.ObjectFieldFlags.Model | AuthorShared.ObjectFieldFlags.Instance, new GUILayoutOption[0]);
        if (flag1)
        {
            bodyPart1 = (BodyPart)AuthorShared.EnumField("Body Part", bodyPart1, new GUILayoutOption[0]);
            AuthorShared.BeginHorizontal(new GUILayoutOption[0]);
            bool flag3 = GUILayout.Toggle(this.mirrorX, "Mirror X", new GUILayoutOption[0]);
            bool flag4 = GUILayout.Toggle(this.mirrorY, "Mirror Y", new GUILayoutOption[0]);
            bool flag5 = GUILayout.Toggle(this.mirrorZ, "Mirror Z", new GUILayoutOption[0]);
            AuthorShared.EndHorizontal();
            if (flag3 != this.mirrorX || flag4 != this.mirrorY || flag5 != this.mirrorZ)
            {
                this.mirrorX = flag3;
                this.mirrorY = flag4;
                this.mirrorZ = flag5;
                flag         = true;
            }
        }
        AuthorShared.EndVertical();
        Vector3 vector3  = this.center;
        float   single   = this.radius;
        float   single1  = this.height;
        Vector3 vector31 = this.size;
        int     num      = this.capsuleAxis;

        AuthorShared.BeginSubSection("Shape", new GUILayoutOption[0]);
        HitShapeKind hitShapeKind = (HitShapeKind)AuthorShared.EnumField("Kind", this.kind, new GUILayoutOption[0]);

        switch (this.kind)
        {
        case HitShapeKind.Sphere:
        {
            vector3 = AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            single  = Mathf.Max(AuthorShared.FloatField("Radius", this.radius, new GUILayoutOption[0]), 0.001f);
            goto case HitShapeKind.Line;
        }

        case HitShapeKind.Capsule:
        {
            vector3 = AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            single  = Mathf.Max(AuthorShared.FloatField("Radius", this.radius, new GUILayoutOption[0]), 0.001f);
            single1 = Mathf.Max(AuthorShared.FloatField("Height", this.height, new GUILayoutOption[0]), 0.001f);
            num     = Mathf.Clamp(AuthorShared.IntField("Height Axis", this.capsuleAxis, new GUILayoutOption[0]), 0, 2);
            goto case HitShapeKind.Line;
        }

        case HitShapeKind.Line:
        {
            AuthorShared.EndSubSection();
            AuthorShared.BeginSubSection("Rigidbody", new GUILayoutOption[0]);
            float single2 = Mathf.Max(AuthorShared.FloatField("Mass", this.mass, new GUILayoutOption[0]), 0.001f);
            float single3 = Mathf.Max(AuthorShared.FloatField("Drag", this.drag, new GUILayoutOption[0]), 0f);
            float single4 = Mathf.Max(AuthorShared.FloatField("Angular Drag", this.angularDrag, new GUILayoutOption[0]), 0f);
            AuthorShared.EndSubSection();
            AuthorShared.BeginSubSection("Hit Box", new GUILayoutOption[0]);
            int   num1    = this.hitPriority;
            float single5 = this.damageMultiplier;
            if (flag1 || flag2)
            {
                num1    = AuthorShared.IntField("Hit Priority", num1, new GUILayoutOption[0]);
                single5 = AuthorShared.FloatField("Damage Mult.", single5, new GUILayoutOption[0]);
            }
            AuthorShared.EndSubSection();
            bool flag6 = GUILayout.Button("Add Joint", new GUILayoutOption[0]);
            if (Event.current.type == EventType.Repaint)
            {
                this.lastPopupRect = GUILayoutUtility.GetLastRect();
            }
            if (flag6)
            {
                AuthorShared.CustomMenu(this.lastPopupRect, AuthorChHit.JointMenu.options, 0, new AuthorShared.CustomMenuProc(AuthorChHit.JointMenu.Callback), this);
            }
            if (hitShapeKind != this.kind || vector3 != this.center || vector31 != this.size || single != this.radius || single1 != this.height || num != this.capsuleAxis || single2 != this.mass || single3 != this.drag || single4 != this.angularDrag || bodyPart != this.bodyPart || bodyPart1 != this.mirroredBodyPart || this.hitPriority != num1 || single5 != this.damageMultiplier)
            {
                flag                  = true;
                this.kind             = hitShapeKind;
                this.center           = vector3;
                this.size             = vector31;
                this.radius           = single;
                this.height           = single1;
                this.capsuleAxis      = num;
                this.mass             = single2;
                this.drag             = single3;
                this.angularDrag      = single4;
                this.bodyPart         = bodyPart;
                this.mirroredBodyPart = bodyPart1;
                this.hitPriority      = num1;
                this.damageMultiplier = single5;
            }
            return(flag);
        }

        case HitShapeKind.Box:
        {
            vector3  = AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            vector31 = AuthorShared.Vector3Field("Size", this.size, new GUILayoutOption[0]);
            goto case HitShapeKind.Line;
        }

        default:
        {
            goto case HitShapeKind.Line;
        }
        }
    }