예제 #1
0
    protected override void OnRegistered()
    {
        int    num;
        string str = base.peiceID;

        if (str != null)
        {
            if (AuthorChHit.< > f__switch$map1 == null)
            {
                Dictionary <string, int> strs = new Dictionary <string, int>(3)
                {
                    { "Sphere", 0 },
                    { "Box", 1 },
                    { "Capsule", 2 }
                };
                AuthorChHit.< > f__switch$map1 = strs;
            }
            if (AuthorChHit.< > f__switch$map1.TryGetValue(str, out num))
            {
                switch (num)
                {
                case 0:
                {
                    this.kind = HitShapeKind.Sphere;
                    break;
                }

                case 1:
                {
                    this.kind = HitShapeKind.Box;
                    break;
                }

                case 2:
                {
                    this.kind = HitShapeKind.Capsule;
                    break;
                }
                }
            }
        }
        base.OnRegistered();
    }
    // Token: 0x060001C4 RID: 452 RVA: 0x00007320 File Offset: 0x00005520
    public override bool PeiceInspectorGUI()
    {
        bool   flag    = base.PeiceInspectorGUI();
        string peiceID = base.peiceID;

        if (global::AuthorShared.StringField("Title", ref peiceID, new GUILayoutOption[0]))
        {
            base.peiceID = peiceID;
            flag         = true;
        }
        bool     flag2    = this.mirrored && this.mirrored != this.bone;
        bool     flag3    = this.bone;
        BodyPart bodyPart = this.bodyPart;

        if (global::AuthorShared.ObjectField <Transform>("Bone", ref this.bone, (global::AuthorShared.ObjectFieldFlags) 25, new GUILayoutOption[0]))
        {
            if (!flag3)
            {
                this.FigureOutDefaultBodyPart(this.bone, ref bodyPart);
            }
            flag = true;
        }
        BodyPart bodyPart2 = this.mirroredBodyPart;

        if (flag3)
        {
            bodyPart = (BodyPart)global::AuthorShared.EnumField("Body Part", bodyPart, new GUILayoutOption[0]);
        }
        GUI.Box(global::AuthorShared.BeginVertical(new GUILayoutOption[0]), GUIContent.none);
        flag |= global::AuthorShared.ObjectField <Transform>("Mirrored Bone", ref this.mirrored, (global::AuthorShared.ObjectFieldFlags) 25, new GUILayoutOption[0]);
        if (flag2)
        {
            bodyPart2 = (BodyPart)global::AuthorShared.EnumField("Body Part", bodyPart2, new GUILayoutOption[0]);
            global::AuthorShared.BeginHorizontal(new GUILayoutOption[0]);
            bool flag4 = GUILayout.Toggle(this.mirrorX, "Mirror X", new GUILayoutOption[0]);
            bool flag5 = GUILayout.Toggle(this.mirrorY, "Mirror Y", new GUILayoutOption[0]);
            bool flag6 = GUILayout.Toggle(this.mirrorZ, "Mirror Z", new GUILayoutOption[0]);
            global::AuthorShared.EndHorizontal();
            if (flag4 != this.mirrorX || flag5 != this.mirrorY || flag6 != this.mirrorZ)
            {
                this.mirrorX = flag4;
                this.mirrorY = flag5;
                this.mirrorZ = flag6;
                flag         = true;
            }
        }
        global::AuthorShared.EndVertical();
        Vector3 vector  = this.center;
        float   num     = this.radius;
        float   num2    = this.height;
        Vector3 vector2 = this.size;
        int     num3    = this.capsuleAxis;

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

        switch (this.kind)
        {
        case 1:
            vector = global::AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            num    = Mathf.Max(global::AuthorShared.FloatField("Radius", this.radius, new GUILayoutOption[0]), 0.001f);
            break;

        case 2:
            vector = global::AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            num    = Mathf.Max(global::AuthorShared.FloatField("Radius", this.radius, new GUILayoutOption[0]), 0.001f);
            num2   = Mathf.Max(global::AuthorShared.FloatField("Height", this.height, new GUILayoutOption[0]), 0.001f);
            num3   = Mathf.Clamp(global::AuthorShared.IntField("Height Axis", this.capsuleAxis, new GUILayoutOption[0]), 0, 2);
            break;

        case 4:
            vector  = global::AuthorShared.Vector3Field("Center", this.center, new GUILayoutOption[0]);
            vector2 = global::AuthorShared.Vector3Field("Size", this.size, new GUILayoutOption[0]);
            break;
        }
        global::AuthorShared.EndSubSection();
        global::AuthorShared.BeginSubSection("Rigidbody", new GUILayoutOption[0]);
        float num4 = Mathf.Max(global::AuthorShared.FloatField("Mass", this.mass, new GUILayoutOption[0]), 0.001f);
        float num5 = Mathf.Max(global::AuthorShared.FloatField("Drag", this.drag, new GUILayoutOption[0]), 0f);
        float num6 = Mathf.Max(global::AuthorShared.FloatField("Angular Drag", this.angularDrag, new GUILayoutOption[0]), 0f);

        global::AuthorShared.EndSubSection();
        global::AuthorShared.BeginSubSection("Hit Box", new GUILayoutOption[0]);
        int   num7 = this.hitPriority;
        float num8 = this.damageMultiplier;

        if (flag2 || flag3)
        {
            num7 = global::AuthorShared.IntField("Hit Priority", num7, new GUILayoutOption[0]);
            num8 = global::AuthorShared.FloatField("Damage Mult.", num8, new GUILayoutOption[0]);
        }
        global::AuthorShared.EndSubSection();
        bool flag7 = GUILayout.Button("Add Joint", new GUILayoutOption[0]);

        if (Event.current.type == 7)
        {
            this.lastPopupRect = GUILayoutUtility.GetLastRect();
        }
        if (flag7)
        {
            global::AuthorShared.CustomMenu(this.lastPopupRect, global::AuthorChHit.JointMenu.options, 0, new global::AuthorShared.CustomMenuProc(global::AuthorChHit.JointMenu.Callback), this);
        }
        if (hitShapeKind != this.kind || vector != this.center || vector2 != this.size || num != this.radius || num2 != this.height || num3 != this.capsuleAxis || num4 != this.mass || num5 != this.drag || num6 != this.angularDrag || bodyPart != this.bodyPart || bodyPart2 != this.mirroredBodyPart || this.hitPriority != num7 || num8 != this.damageMultiplier)
        {
            flag                  = true;
            this.kind             = hitShapeKind;
            this.center           = vector;
            this.size             = vector2;
            this.radius           = num;
            this.height           = num2;
            this.capsuleAxis      = num3;
            this.mass             = num4;
            this.drag             = num5;
            this.angularDrag      = num6;
            this.bodyPart         = bodyPart;
            this.mirroredBodyPart = bodyPart2;
            this.hitPriority      = num7;
            this.damageMultiplier = num8;
        }
        return(flag);
    }
예제 #3
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;
        }
        }
    }