Inheritance: ColliderEditorBase
Esempio n. 1
0
 public override void OnInspectorGUI()
 {
     this.m_ShowCompositeRedundants.target = !this.m_UsedByComposite.boolValue;
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowCompositeRedundants.faded))
     {
         this.m_ShowDensity.target = this.ShouldShowDensity();
         if (EditorGUILayout.BeginFadeGroup(this.m_ShowDensity.faded))
         {
             EditorGUILayout.PropertyField(this.m_Density, new GUILayoutOption[0]);
         }
         Collider2DEditorBase.FixedEndFadeGroup(this.m_ShowDensity.faded);
         EditorGUILayout.PropertyField(this.m_Material, new GUILayoutOption[0]);
         EditorGUILayout.PropertyField(this.m_IsTrigger, new GUILayoutOption[0]);
         EditorGUILayout.PropertyField(this.m_UsedByEffector, new GUILayoutOption[0]);
     }
     Collider2DEditorBase.FixedEndFadeGroup(this.m_ShowCompositeRedundants.faded);
     if ((from x in base.targets
          where !(x as Collider2D).compositeCapable
          select x).Count <UnityEngine.Object>() == 0)
     {
         EditorGUILayout.PropertyField(this.m_UsedByComposite, new GUILayoutOption[0]);
     }
     if (this.m_AutoTiling != null)
     {
         EditorGUILayout.PropertyField(this.m_AutoTiling, Collider2DEditorBase.Styles.s_AutoTilingLabel, new GUILayoutOption[0]);
     }
     EditorGUILayout.PropertyField(this.m_Offset, new GUILayoutOption[0]);
 }
Esempio n. 2
0
 private void ShowContacts(Collider2D collider)
 {
     EditorGUI.indentLevel++;
     this.m_ShowContacts.target = EditorGUILayout.Foldout(this.m_ShowContacts.target, "Contacts");
     if (EditorGUILayout.BeginFadeGroup(this.m_ShowContacts.faded))
     {
         int contacts = collider.GetContacts(Collider2DEditorBase.m_Contacts);
         if (contacts > 0)
         {
             this.m_ContactScrollPosition = EditorGUILayout.BeginScrollView(this.m_ContactScrollPosition, new GUILayoutOption[]
             {
                 GUILayout.Height(180f)
             });
             EditorGUI.BeginDisabledGroup(true);
             for (int i = 0; i < contacts; i++)
             {
                 ContactPoint2D contactPoint2D = Collider2DEditorBase.m_Contacts[i];
                 EditorGUILayout.HelpBox(string.Format("Contact#{0}", i), MessageType.None);
                 EditorGUI.indentLevel++;
                 EditorGUILayout.Vector2Field("Point", contactPoint2D.point, new GUILayoutOption[0]);
                 EditorGUILayout.Vector2Field("Normal", contactPoint2D.normal, new GUILayoutOption[0]);
                 EditorGUILayout.Vector2Field("Relative Velocity", contactPoint2D.relativeVelocity, new GUILayoutOption[0]);
                 EditorGUILayout.FloatField("Normal Impulse", contactPoint2D.normalImpulse, new GUILayoutOption[0]);
                 EditorGUILayout.FloatField("Tangent Impulse", contactPoint2D.tangentImpulse, new GUILayoutOption[0]);
                 EditorGUILayout.ObjectField("Collider", contactPoint2D.collider, typeof(Collider2D), false, new GUILayoutOption[0]);
                 EditorGUILayout.ObjectField("Rigidbody", contactPoint2D.rigidbody, typeof(Rigidbody2D), false, new GUILayoutOption[0]);
                 EditorGUILayout.ObjectField("OtherRigidbody", contactPoint2D.otherRigidbody, typeof(Rigidbody2D), false, new GUILayoutOption[0]);
                 EditorGUI.indentLevel--;
                 EditorGUILayout.Space();
             }
             EditorGUI.EndDisabledGroup();
             EditorGUILayout.EndScrollView();
         }
         else
         {
             EditorGUILayout.HelpBox("No Contacts", MessageType.Info);
         }
     }
     Collider2DEditorBase.FixedEndFadeGroup(this.m_ShowContacts.faded);
     EditorGUI.indentLevel--;
 }