public override void OnInspectorGUI()
 {
   if (NavMeshAgentInspector.s_Styles == null)
     NavMeshAgentInspector.s_Styles = new NavMeshAgentInspector.Styles();
   this.serializedObject.Update();
   EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
   EditorGUILayout.PropertyField(this.m_Radius);
   EditorGUILayout.PropertyField(this.m_Height);
   EditorGUILayout.PropertyField(this.m_BaseOffset);
   EditorGUILayout.Space();
   EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentSteeringHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
   EditorGUILayout.PropertyField(this.m_Speed);
   EditorGUILayout.PropertyField(this.m_AngularSpeed);
   EditorGUILayout.PropertyField(this.m_Acceleration);
   EditorGUILayout.PropertyField(this.m_StoppingDistance);
   EditorGUILayout.PropertyField(this.m_AutoBraking);
   EditorGUILayout.Space();
   EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentAvoidanceHeader, EditorStyles.boldLabel, 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);
   EditorGUILayout.PropertyField(this.m_AutoRepath);
   string[] navMeshAreaNames = GameObjectUtility.GetNavMeshAreaNames();
   long longValue = this.m_WalkableMask.longValue;
   int mask = 0;
   for (int index = 0; index < navMeshAreaNames.Length; ++index)
   {
     if (((long) (1 << GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[index])) & longValue) != 0L)
       mask |= 1 << index;
   }
   Rect rect = GUILayoutUtility.GetRect(EditorGUILayout.kLabelFloatMinW, EditorGUILayout.kLabelFloatMaxW, 16f, 16f, EditorStyles.layerMaskField);
   EditorGUI.BeginChangeCheck();
   EditorGUI.showMixedValue = this.m_WalkableMask.hasMultipleDifferentValues;
   int num1 = EditorGUI.MaskField(rect, "Area Mask", mask, navMeshAreaNames, EditorStyles.layerMaskField);
   EditorGUI.showMixedValue = false;
   if (EditorGUI.EndChangeCheck())
   {
     if (num1 == -1)
     {
       this.m_WalkableMask.longValue = (long) uint.MaxValue;
     }
     else
     {
       uint num2 = 0;
       for (int index = 0; index < navMeshAreaNames.Length; ++index)
       {
         if ((num1 >> index & 1) != 0)
           num2 |= (uint) (1 << GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[index]));
       }
       this.m_WalkableMask.longValue = (long) num2;
     }
   }
   this.serializedObject.ApplyModifiedProperties();
 }
Example #2
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();
        }
		public override void OnInspectorGUI()
		{
			if (NavMeshAgentInspector.s_Styles == null)
			{
				NavMeshAgentInspector.s_Styles = new NavMeshAgentInspector.Styles();
			}
			base.serializedObject.Update();
			EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentSizeHeader, 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_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_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();
			int intValue = this.m_WalkableMask.intValue;
			int num = 0;
			for (int i = 0; i < navMeshAreaNames.Length; i++)
			{
				int navMeshAreaFromName = GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[i]);
				if ((1 << navMeshAreaFromName & intValue) > 0)
				{
					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.intValue = -1;
				}
				else
				{
					int num3 = 0;
					for (int j = 0; j < navMeshAreaNames.Length; j++)
					{
						if ((num2 >> j & 1) > 0)
						{
							num3 |= 1 << GameObjectUtility.GetNavMeshAreaFromName(navMeshAreaNames[j]);
						}
					}
					this.m_WalkableMask.intValue = num3;
				}
			}
			base.serializedObject.ApplyModifiedProperties();
		}
Example #4
0
        public override void OnInspectorGUI()
        {
            if (NavMeshAgentInspector.s_Styles == null)
            {
                NavMeshAgentInspector.s_Styles = new NavMeshAgentInspector.Styles();
            }
            this.serializedObject.Update();
            EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentSizeHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Radius);
            EditorGUILayout.PropertyField(this.m_Height);
            EditorGUILayout.PropertyField(this.m_BaseOffset);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentSteeringHeader, EditorStyles.boldLabel, new GUILayoutOption[0]);
            EditorGUILayout.PropertyField(this.m_Speed);
            EditorGUILayout.PropertyField(this.m_AngularSpeed);
            EditorGUILayout.PropertyField(this.m_Acceleration);
            EditorGUILayout.PropertyField(this.m_StoppingDistance);
            EditorGUILayout.PropertyField(this.m_AutoBraking);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField(NavMeshAgentInspector.s_Styles.m_AgentAvoidanceHeader, EditorStyles.boldLabel, 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);
            EditorGUILayout.PropertyField(this.m_AutoRepath);
            string[] navMeshAreaNames = GameObjectUtility.GetNavMeshAreaNames();
            long     longValue        = this.m_WalkableMask.longValue;
            int      mask             = 0;

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

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

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