示例#1
0
        public override void OnInspectorGUI()
        {
            if (NavMeshAgentInspector.s_Styles == null)
            {
                NavMeshAgentInspector.s_Styles = new NavMeshAgentInspector.Styles();
            }
            base.serializedObject.Update();
            NavMeshAgentInspector.AgentTypePopupInternal("Agent Type", this.m_AgentTypeID);
            EditorGUILayout.PropertyField(this.m_BaseOffset, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentSteeringHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Speed, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AngularSpeed, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Acceleration, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_StoppingDistance, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AutoBraking, new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentAvoidanceHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Radius, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Height, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_ObstacleAvoidanceType, GUIContent.Temp("Quality"), new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AvoidancePriority, GUIContent.Temp("Priority"), new GUILayoutOption[0]);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentPathFindingHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AutoTraverseOffMeshLink, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_AutoRepath, new GUILayoutOption[0]);
            string[] navMeshAreaNames = GameObjectUtility.GetNavMeshAreaNames();
            long     longValue        = this.m_WalkableMask.longValue;
            int      num = 0;

            for (int i = 0; i < navMeshAreaNames.Length; i++)
            {
                int navMeshAreaFromName = GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[i]);
                if ((1L << (navMeshAreaFromName & 31) & longValue) != 0L)
                {
                    num |= 1 << i;
                }
            }
            Rect rect = GUILayoutUtility.GetRect(EditorGUILayout.kLabelFloatMinW, EditorGUILayout.kLabelFloatMaxW, 16f, 16f, EditorStyles.layerMaskField);

            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = this.m_WalkableMask.hasMultipleDifferentValues;
            int num2 = EditorGUI.MaskField(rect, "Area Mask", num, navMeshAreaNames, EditorStyles.layerMaskField);

            EditorGUI.showMixedValue = false;
            if (EditorGUI.EndChangeCheck())
            {
                if (num2 == -1)
                {
                    this.m_WalkableMask.longValue = (long)((ulong)-1);
                }
                else
                {
                    uint num3 = 0u;
                    for (int j = 0; j < navMeshAreaNames.Length; j++)
                    {
                        if ((num2 >> j & 1) != 0)
                        {
                            num3 |= 1u << GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[j]);
                        }
                    }
                    this.m_WalkableMask.longValue = (long)((ulong)num3);
                }
            }
            base.serializedObject.ApplyModifiedProperties();
        }