Exemplo n.º 1
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        var script = target as Seeker;

        Undo.RecordObject(script, "modify settings on Seeker");

        // Show a dropdown selector for the tags that this seeker can traverse
        // A callback is necessary because Unity's GenericMenu uses callbacks
        EditorGUILayoutx.TagMaskField(new GUIContent("Valid Tags"), script.traversableTags, result => script.traversableTags = result);

#if !ASTAR_NoTagPenalty
        EditorGUI.indentLevel = 0;
        tagPenaltiesOpen      = EditorGUILayout.Foldout(tagPenaltiesOpen, new GUIContent("Tag Penalties", "Penalties for each tag"));
        if (tagPenaltiesOpen)
        {
            EditorGUI.indentLevel = 2;
            string[] tagNames = AstarPath.FindTagNames();
            for (int i = 0; i < script.tagPenalties.Length; i++)
            {
                int tmp = EditorGUILayout.IntField((i < tagNames.Length ? tagNames[i] : "Tag " + i), (int)script.tagPenalties[i]);
                if (tmp < 0)
                {
                    tmp = 0;
                }

                // If the new value is different than the old one
                // Update the value and mark the script as dirty
                if (script.tagPenalties[i] != tmp)
                {
                    script.tagPenalties[i] = tmp;
                    EditorUtility.SetDirty(target);
                }
            }
            if (GUILayout.Button("Edit Tag Names..."))
            {
                AstarPathEditor.EditTags();
            }
        }
        EditorGUI.indentLevel = 1;
#endif

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 2
0
        private void OnGUI()
        {
            EditorGUILayout.LabelField(Content.Title, Styles.Title, GUILayout.ExpandWidth(true));

            EditorGUILayoutx.Splitter();

            using (new EditorGUILayout.ScrollViewScope(scrollPosition))
            {
                EditorGUILayout.LabelField
                (
                    "Developed by Keenan Woodall.",
                    Styles.CreditsText
                );

                EditorGUILayout.Space();

                if (EditorGUILayoutx.LinkLabel(Content.Twitter))
                {
                    Application.OpenURL("https://twitter.com/keenanwoodall");
                }

                if (EditorGUILayoutx.LinkLabel(Content.GitHub))
                {
                    Application.OpenURL("https://github.com/keenanwoodall");
                }

                if (EditorGUILayoutx.LinkLabel(Content.Website))
                {
                    Application.OpenURL("http://keenanwoodall.com");
                }

                EditorGUILayout.Space();

                EditorGUILayout.LabelField
                (
                    "Thanks to Thomas Ingram for helping with development.",
                    Styles.CreditsText
                );

                EditorGUILayout.Space();

                EditorGUILayout.LabelField
                (
                    "Thanks to Alexander Ameye, William Besnard, Raphael Herdlicka and David Carney for testing and providing feedback.",
                    Styles.CreditsText
                );
            }
        }
Exemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayout.Slider(properties.Factor, 0f, 1f, Content.Factor);
            EditorGUILayoutx.MaxField(properties.InnerRadius, properties.OuterRadius.floatValue, Content.InnerRadius);
            EditorGUILayoutx.MinField(properties.OuterRadius, properties.InnerRadius.floatValue, Content.OuterRadius);
            EditorGUILayout.PropertyField(properties.Invert, Content.Invert);
            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayout.PropertyField(properties.Factor, Content.Factor);
            EditorGUILayoutx.MinField(properties.Top, properties.Bottom.floatValue, Content.Top);
            EditorGUILayoutx.MaxField(properties.Bottom, properties.Top.floatValue, Content.Bottom);
            EditorGUILayout.PropertyField(properties.Smooth, Content.Smooth);
            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 5
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayout.PropertyField(properties.Factor, Content.Factor);
            EditorGUILayout.PropertyField(properties.Offset, Content.Offset);
            EditorGUILayoutx.MinField(properties.Falloff, 0f, Content.Falloff);
            EditorGUILayout.PropertyField(properties.Curve, Content.Curve);
            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 6
0
    public override void OnInspectorGUI(NavGraph target)
    {
        ListGraph graph = target as ListGraph;

/*
 #if UNITY_3_3
 *              graph.root = (Transform)EditorGUILayout.ObjectField (new GUIContent ("Root","All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"),graph.root,typeof(Transform));
 #else
 *              graph.root = (Transform)EditorGUILayout.ObjectField (new GUIContent ("Root","All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"),graph.root,typeof(Transform),true);
 #endif
 */
        graph.root = ObjectField(new GUIContent("Root", "All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"), graph.root, typeof(Transform), true) as Transform;

        graph.recursive = EditorGUILayout.Toggle(new GUIContent("Recursive", "Should childs of the childs in the root GameObject be searched"), graph.recursive);
        graph.searchTag = EditorGUILayout.TagField(new GUIContent("Tag", "If root is not set, all objects with this tag will be used as nodes"), graph.searchTag);

        if (graph.root != null)
        {
            GUILayout.Label("All childs " + (graph.recursive ? "and sub-childs ":"") + "of 'root' will be used as nodes\nSet root to null to use a tag search instead", AstarPathEditor.helpBox);
        }
        else
        {
            GUILayout.Label("All object with the tag '" + graph.searchTag + "' will be used as nodes" + (graph.searchTag == "Untagged" ? "\nNote: the tag 'Untagged' cannot be used" : ""), AstarPathEditor.helpBox);
        }

        graph.maxDistance = EditorGUILayout.FloatField(new GUIContent("Max Distance", "The max distance in world space for a connection to be valid. A zero counts as infinity"), graph.maxDistance);
        graph.limits      = EditorGUILayout.Vector3Field("Max Distance (axis aligned)", graph.limits);
        graph.raycast     = EditorGUILayout.Toggle(new GUIContent("Raycast", "Use raycasting to check if connections are valid between each pair of nodes"), graph.raycast);

        editor.GUILayoutx.BeginFadeArea(graph.raycast, "raycast");

        EditorGUI.indentLevel++;

        graph.thickRaycast = EditorGUILayout.Toggle(new GUIContent("Thick Raycast", "A thick raycast checks along a thick line with radius instead of just along a line"), graph.thickRaycast);

        editor.GUILayoutx.BeginFadeArea(graph.thickRaycast, "thickRaycast");

        graph.thickRaycastRadius = EditorGUILayout.FloatField(new GUIContent("Raycast Radius", "The radius in world units for the thick raycast"), graph.thickRaycastRadius);

        editor.GUILayoutx.EndFadeArea();

        //graph.mask = 1 << EditorGUILayout.LayerField ("Mask",(int)Mathf.Log (graph.mask,2));
        graph.mask = EditorGUILayoutx.LayerMaskField(/*new GUIContent (*/ "Mask" /*,"Used to mask which layers should be checked")*/, graph.mask);
        EditorGUI.indentLevel--;

        editor.GUILayoutx.EndFadeArea();
    }
Exemplo n.º 7
0
 public virtual void EditDecalData()
 {
     EnableEditDecalData = EditorGUILayout.BeginToggleGroup("---Edit Decal Data", EnableEditDecalData);
     if (EnableEditDecalData)
     {
         if (GUILayout.Button("Add Decal data"))
         {
             DecalData         DecalData = new DecalData();
             IList <DecalData> l         = selectedRagdoll.DecalData.ToList <DecalData> ();
             l.Add(DecalData);
             selectedRagdoll.DecalData = l.ToArray <DecalData> ();
         }
         for (int i = 0; i < selectedRagdoll.DecalData.Length; i++)
         {
             DecalData DecalData = selectedRagdoll.DecalData [i];
             EditorGUILayout.LabelField("------------------------ " + DecalData.Name);
             DecalData.Name           = EditorGUILayout.TextField(new GUIContent("Name", ""), DecalData.Name);
             DecalData.UseGlobalDecal = EditorGUILayout.Toggle(new GUIContent("UseGlobalDecal?", "使用全局Decal设定?"), DecalData.UseGlobalDecal);
             if (DecalData.UseGlobalDecal)
             {
                 DecalData.GlobalType = (GlobalDecalType)EditorGUILayout.EnumPopup(new GUIContent("Global decal type:", ""), DecalData.GlobalType);
             }
             else
             {
                 DecalData.DestoryInTimeOut = EditorGUILayout.Toggle(new GUIContent("Destory this decal in timeout?", "Decal是否有Lifetime?"), DecalData.DestoryInTimeOut);
                 if (DecalData.DestoryInTimeOut)
                 {
                     DecalData.DestoryTimeOut = EditorGUILayout.FloatField(new GUIContent("Destory Timeout:", ""), DecalData.DestoryTimeOut);
                 }
                 DecalData.ProjectDirection = (HorizontalOrVertical)EditorGUILayout.EnumPopup(new GUIContent("Decal Project Direction", "创建Decal的投射方向,对于地上的Decal,投射方向是Vertical,对于墙上的Decal,投射方向是Horizontal."), DecalData.ProjectDirection);
                 DecalData.ApplicableLayer  = EditorGUILayoutx.LayerMaskField("ApplicableLayer", DecalData.ApplicableLayer);
                 DecalData.DecalObjects     = AIEditor.EditObjectArray("--------------Edit Decal object ------", DecalData.DecalObjects);
                 DecalData.ScaleRate        = EditorGUILayout.FloatField(new GUIContent("Scale rate:", "Final scale = initial scale * ScaleRate"), DecalData.ScaleRate);
                 //Delete this DecalData
                 if (GUILayout.Button("Delete DecalData:" + DecalData.Name))
                 {
                     IList <DecalData> l = selectedRagdoll.DecalData.ToList <DecalData> ();
                     l.Remove(DecalData);
                     selectedRagdoll.DecalData = l.ToArray <DecalData> ();
                 }
             }
             EditorGUILayout.Space();
         }
     }
     EditorGUILayout.EndToggleGroup();
 }
Exemplo n.º 8
0
		public override void OnInspectorGUI ()
		{
			base.OnInspectorGUI ();

			serializedObject.UpdateIfRequiredOrScript ();

			deformerList.DoLayoutList ();

			serializedObject.ApplyModifiedProperties ();

			EditorGUILayout.Space ();

			var newDeformers = EditorGUILayoutx.DragAndDropArea<Deformer> ();
			if (newDeformers != null && newDeformers.Count > 0)
			{
				Undo.RecordObjects (targets, "Added Deformers");
				foreach (var t in targets)
				{
					var elements = ((GroupDeformer)t).DeformerElements;
					foreach (var newDeformer in newDeformers)
						elements.Add (new DeformerElement (newDeformer));
				}
			}

			EditorGUILayout.Space ();

			using (new EditorGUILayout.HorizontalScope ())
			{
				if (GUILayout.Button (Content.ClearDeformers, EditorStyles.miniButtonLeft))
				{
					Undo.RecordObjects (targets, "Cleared Deformers");
					foreach (var t in targets)
						((GroupDeformer)t).DeformerElements.Clear ();
				}

				if (GUILayout.Button (Content.CleanDeformers, EditorStyles.miniButtonRight))
				{
					Undo.RecordObjects (targets, "Cleaned Deformers");
					foreach (var t in targets)
						((GroupDeformer)t).DeformerElements.RemoveAll (d => d.Component == null);
				}
			}

			EditorApplication.QueuePlayerLoopUpdate ();
		}
Exemplo n.º 9
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayout.Slider(properties.Factor, 0f, 1f, Content.Factor);
            EditorGUILayout.PropertyField(properties.Width, Content.Width);
            EditorGUILayout.PropertyField(properties.Height, Content.Height);
            EditorGUILayout.PropertyField(properties.Length, Content.Length);
            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayoutx.WIPAlert();

            EditorApplication.QueuePlayerLoopUpdate();
        }
    public override void OnInspectorGUI(NavGraph target)
    {
        var graph = target as GridJumpGraph;

        graph.maxJumpHeight  = EditorGUILayout.FloatField(new GUIContent("Max Jump Height", "The maximum distance a character can jump. The max distance in world space for a connection to be valid. A zero counts as infinity"), graph.maxJumpHeight);
        graph.maxFlyHeight   = EditorGUILayout.FloatField(new GUIContent("Max Fly Height", "The maximum distance a character can fly. The max distance in world space for a connection to be valid. A zero counts as infinity"), graph.maxFlyHeight);
        graph.diggableLayers = EditorGUILayoutx.LayerMaskField("Diggable layers", graph.diggableLayers);

        GUILayout.Label("Make sure to set seeker to search using correct tags depending on what it can do");
        graph.walkableTag = (uint)EditorGUILayoutx.TagField("Walkable tag", (int)graph.walkableTag);
        graph.jumpableTag = (uint)EditorGUILayoutx.TagField("Jumpable tag", (int)graph.jumpableTag);
        graph.flyableTag  = (uint)EditorGUILayoutx.TagField("Flyable tag", (int)graph.flyableTag);
        graph.diggableTag = (uint)EditorGUILayoutx.TagField("Diggable tag", (int)graph.diggableTag);

        //graph.maxDropHeight = EditorGUILayout.FloatField(new GUIContent("Max Drop Height", "The maximum distance a character can drop willingly. The max distance in world space for a connection to be valid. A zero counts as infinity"), graph.maxDropHeight);

        base.OnInspectorGUI(graph);
    }
Exemplo n.º 11
0
    public virtual void EditBaseAIProperty(AI AI)
    {
        EditorGUILayout.LabelField(new GUIContent("------------- AI Base property", ""));
        AI.Name           = EditorGUILayout.TextField(new GUIContent("AI Name", "Name of this AI component."), AI.Name);
        AI.Description    = EditorGUILayout.TextField(new GUIContent("AI Description", "Description:."), AI.Description);
        AI.OffensiveRange = EditorGUILayout.FloatField(new GUIContent("AI Offensive range", "当敌人进入Offsensive range, AI会主动发起进攻."), AI.OffensiveRange);
        AI.DetectiveRange = EditorGUILayout.FloatField(new GUIContent("AI Detective range", "当敌人进入Detective range, AI会监测到这个敌人.DetectiveRange应该大于Offensive Range."), AI.DetectiveRange);
        AI.DetectiveRange = AI.DetectiveRange >= AI.OffensiveRange ? AI.DetectiveRange : AI.OffensiveRange;
        EditorGUILayout.BeginHorizontal();
        GUILayout.Label(new GUIContent("Attack Obstacle:", "攻击障碍物层,如果目标和AI之间存在该层的碰撞器,则AI无法攻击到目标."));
        AI.AttackObstacle = EditorGUILayoutx.LayerMaskField("", AI.AttackObstacle);
        EditorGUILayout.EndHorizontal();
//		AI.AlterBehaviorInterval = EditorGUILayout.FloatField (new GUIContent ("Behavior alternation time",
//            "Interval to alter behavior."), AI.AlterBehaviorInterval);

        AIBehavior[] AIBehaviors = this.AI.Behaviors;
        this.AI.FirstBehavior = EditorCommon.EditPopup("First Behavior:", this.AI.FirstBehavior, AIBehaviors.Select(x => x.Name).ToArray());
    }
Exemplo n.º 12
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayoutx.MinField(properties.WaveLength, 0f, Content.WaveLength);
            EditorGUILayout.Slider(properties.Steepness, 0f, 1f, Content.Steepness);
            EditorGUILayout.PropertyField(properties.Speed, Content.Speed);
            EditorGUILayout.PropertyField(properties.Offset, Content.Offset);
            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayoutx.WIPAlert();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 13
0
    public override void OnInspectorGUI(NavGraph target)
    {
        ListGraph graph = target as ListGraph;

#if UNITY_3_3
        graph.root = (Transform)EditorGUILayout.ObjectField(new GUIContent("Root", "All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"), graph.root, typeof(Transform));
#else
        graph.root = (Transform)EditorGUILayout.ObjectField(new GUIContent("Root", "All childs of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"), graph.root, typeof(Transform), true);
#endif
        graph.recursive = EditorGUILayout.Toggle(new GUIContent("Recursive", "Should childs of the childs in the root GameObject be searched"), graph.recursive);
        graph.searchTag = EditorGUILayout.TagField(new GUIContent("Tag", "If root is not set, all objects with this tag will be used as nodes"), graph.searchTag);

        if (graph.root != null)
        {
            GUILayout.Label("All childs " + (graph.recursive ? "and sub-childs ":"") + "of 'root' will be used as nodes\nSet root to null to use a tag search instead", AstarPathEditor.helpBox);
        }
        else
        {
            GUILayout.Label("All object with the tag '" + graph.searchTag + "' will be used as nodes" + (graph.searchTag == "Untagged" ? "\nNote: the tag 'Untagged' cannot be used" : ""), AstarPathEditor.helpBox);
        }

        graph.maxDistance = EditorGUILayout.FloatField("Max Distance", graph.maxDistance);
        graph.limits      = EditorGUILayout.Vector3Field("Max Distance (axis aligned)", graph.limits);
        graph.raycast     = EditorGUILayout.Toggle("Raycast", graph.raycast);

        editor.GUILayoutx.BeginFadeArea(graph.raycast, "raycast");

        EditorGUI.indentLevel++;

        graph.thickRaycast = EditorGUILayout.Toggle("Thick Raycast", graph.thickRaycast);

        editor.GUILayoutx.BeginFadeArea(graph.thickRaycast, "thickRaycast");

        graph.thickRaycastRadius = EditorGUILayout.FloatField("Raycast Radius", graph.thickRaycastRadius);

        editor.GUILayoutx.EndFadeArea();

        //graph.mask = 1 << EditorGUILayout.LayerField ("Mask",(int)Mathf.Log (graph.mask,2));
        graph.mask = EditorGUILayoutx.LayerMaskField("Mask", graph.mask);
        EditorGUI.indentLevel--;

        editor.GUILayoutx.EndFadeArea();
    }
Exemplo n.º 14
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayoutx.MinField(properties.Factor, 0f, Content.Factor);
            EditorGUILayoutx.MinField(properties.Falloff, 0f);
            EditorGUILayout.PropertyField(properties.Radius, Content.Radius);
            EditorGUILayout.PropertyField(properties.UseNormals, Content.UseNormals);
            EditorGUILayout.PropertyField(properties.ClampAtBottom, Content.ClampAtBottom);
            EditorGUILayoutx.MinField(properties.Top, properties.Bottom.floatValue, Content.Top);
            EditorGUILayoutx.MaxField(properties.Bottom, properties.Top.floatValue, Content.Bottom);

            EditorGUILayout.LabelField(Content.Noise);
            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.LabelField(Content.Vertical);

                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(properties.VerticalFrequency, Content.VerticalFrequency);
                    EditorGUILayout.PropertyField(properties.VerticalMagnitude, Content.VerticalMagnitude);
                }

                EditorGUILayout.LabelField(Content.Radial);

                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(properties.RadialFrequency, Content.RadialFrequency);
                    EditorGUILayout.PropertyField(properties.RadialMagnitude, Content.RadialMagnitude);
                }
            }

            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayoutx.WIPAlert();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 15
0
 public static PredatorPlayerJumpData EditJumpData(GameObject gameObject, PredatorPlayerJumpData jumpData)
 {
     jumpData.Name                  = EditorGUILayout.TextField("Name:", jumpData.Name);
     jumpData.JumpForwardTime       = EditorGUILayout.FloatField("Jump forward time", jumpData.JumpForwardTime);
     jumpData.JumpForwardSpeed      = EditorGUILayout.FloatField("Jump forward speed", jumpData.JumpForwardSpeed);
     jumpData.JumpOverSpeed         = EditorGUILayout.FloatField("Jump over speed", jumpData.JumpOverSpeed);
     jumpData.JumpOverCheckDistance = EditorGUILayout.FloatField("Jump over obstacle test distance", jumpData.JumpOverCheckDistance);
     jumpData.ObstacleToJumpOver    = EditorGUILayoutx.LayerMaskField("Jump over obstacle layer:", jumpData.ObstacleToJumpOver);
     jumpData.AnimationLayer        = EditorGUILayout.IntField("Jump animation layer:", jumpData.AnimationLayer);
     jumpData.PreJumpAnimation      = EditorCommon.EditPopup("PreJump Animation",
                                                             jumpData.PreJumpAnimation,
                                                             EditorCommon.GetAnimationNames(gameObject));
     jumpData.JumpingAnimation = EditorCommon.EditPopup("Jumping Animation",
                                                        jumpData.JumpingAnimation,
                                                        EditorCommon.GetAnimationNames(gameObject));
     jumpData.GroundingAnimation = EditorCommon.EditPopup("Grounding Animation",
                                                          jumpData.GroundingAnimation,
                                                          EditorCommon.GetAnimationNames(gameObject));
     return(jumpData);
 }
Exemplo n.º 16
0
    void DrawTagField()
    {
        EditorGUILayout.PropertyField(modifyTag, new GUIContent("Modify Tag", "Should the tags of the nodes be modified"));
        if (!modifyTag.hasMultipleDifferentValues && modifyTag.boolValue)
        {
            EditorGUI.indentLevel++;
            EditorGUI.showMixedValue = tagValue.hasMultipleDifferentValues;
            EditorGUI.BeginChangeCheck();
            var newTag = EditorGUILayoutx.TagField("Tag Value", tagValue.intValue);
            if (EditorGUI.EndChangeCheck())
            {
                tagValue.intValue = newTag;
            }
            EditorGUI.indentLevel--;
        }

        if (GUILayout.Button("Tags can be used to restrict which units can walk on what ground. Click here for more info", "HelpBox"))
        {
            Application.OpenURL(AstarUpdateChecker.GetURL("tags"));
        }
    }
Exemplo n.º 17
0
    public virtual void EditBooleanConditionData(AtomConditionData ConditionData)
    {
        EditorGUILayout.BeginHorizontal();
        ConditionData.BooleanCondition = (AIBooleanConditionEnum)EditorGUILayout.EnumPopup(ConditionData.BooleanCondition);
        ConditionData.BooleanOperator  = (BooleanComparisionOperator)EditorGUILayout.EnumPopup(ConditionData.BooleanOperator);
        switch (ConditionData.BooleanCondition)
        {
        case AIBooleanConditionEnum.AlwaysTrue:
            break;

        case AIBooleanConditionEnum.CurrentTargetInLayer:
            ConditionData.LayerMaskForComparision = EditorGUILayoutx.LayerMaskField("Current target in layermask:", ConditionData.LayerMaskForComparision);
            break;

        case AIBooleanConditionEnum.EnemyInDetectiveRange:
            break;

        case AIBooleanConditionEnum.EnemyInOffensiveRange:
            break;

        case AIBooleanConditionEnum.InArea:
            ConditionData.CheckArea = (Collider)EditorGUILayout.ObjectField("Check against collider:", ConditionData.CheckArea, typeof(Collider));
            break;

        case AIBooleanConditionEnum.LatestBehaviorNameIs:
            string[] AllBehaviorName = AI.Behaviors.Select(x => x.Name).ToArray();
            ConditionData.StringValue = EditorCommon.EditPopup("behavior name:", ConditionData.StringValue
                                                               , AllBehaviorName);
            break;

        case AIBooleanConditionEnum.LastestBehaviorNameIsOneOf:
            AllBehaviorName = AI.Behaviors.Select(x => x.Name).ToArray();
            EditorGUILayout.BeginVertical();
            ConditionData.StringValueArray = EditorCommon.EditStringArray("behavior name:", ConditionData.StringValueArray
                                                                          , AllBehaviorName);
            EditorGUILayout.EndVertical();
            break;
        }
        EditorGUILayout.EndHorizontal();
    }
Exemplo n.º 18
0
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();
            EditorGUILayout.PropertyField(properties.Factor, Content.Factor);
            EditorGUILayout.PropertyField(properties.Mode, Content.Mode);

            using (new EditorGUI.DisabledScope((BoundsMode)properties.Mode.enumValueIndex == BoundsMode.Unlimited && !properties.Mode.hasMultipleDifferentValues))
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayoutx.MinField(properties.Top, properties.Bottom.floatValue, Content.Top);
                    EditorGUILayoutx.MaxField(properties.Bottom, properties.Top.floatValue, Content.Bottom);
                }
            }

            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);
            serializedObject.ApplyModifiedProperties();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 19
0
    public override void OnInspectorGUI(NavGraph target)
    {
        PointGraph graph = target as PointGraph;

        graph.root = ObjectField(new GUIContent("Root", "All children of this object will be used as nodes, if it is not set, a tag search will be used instead (see below)"), graph.root, typeof(Transform), true) as Transform;

        graph.recursive = EditorGUILayout.Toggle(new GUIContent("Recursive", "Should children of the children in the root GameObject be searched"), graph.recursive);
        graph.searchTag = EditorGUILayout.TagField(new GUIContent("Tag", "If root is not set, all objects with this tag will be used as nodes"), graph.searchTag);

        if (graph.root != null)
        {
            EditorGUILayout.HelpBox("All children " + (graph.recursive ? "and sub-children " : "") + "of 'root' will be used as nodes\nSet root to null to use a tag search instead", MessageType.None);
        }
        else
        {
            EditorGUILayout.HelpBox("All object with the tag '" + graph.searchTag + "' will be used as nodes" + (graph.searchTag == "Untagged" ? "\nNote: the tag 'Untagged' cannot be used" : ""), MessageType.None);
        }

        graph.maxDistance = EditorGUILayout.FloatField(new GUIContent("Max Distance", "The max distance in world space for a connection to be valid. A zero counts as infinity"), graph.maxDistance);

        graph.limits  = EditorGUILayout.Vector3Field("Max Distance (axis aligned)", graph.limits);
        graph.raycast = EditorGUILayout.Toggle(new GUIContent("Raycast", "Use raycasting to check if connections are valid between each pair of nodes"), graph.raycast);

        if (graph.raycast)
        {
            EditorGUI.indentLevel++;

            graph.thickRaycast = EditorGUILayout.Toggle(new GUIContent("Thick Raycast", "A thick raycast checks along a thick line with radius instead of just along a line"), graph.thickRaycast);

            if (graph.thickRaycast)
            {
                graph.thickRaycastRadius = EditorGUILayout.FloatField(new GUIContent("Raycast Radius", "The radius in world units for the thick raycast"), graph.thickRaycastRadius);
            }

            graph.mask = EditorGUILayoutx.LayerMaskField(/*new GUIContent (*/ "Mask" /*,"Used to mask which layers should be checked")*/, graph.mask);
            EditorGUI.indentLevel--;
        }
    }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();

            serializedObject.UpdateIfRequiredOrScript();

            EditorGUILayout.PropertyField(properties.Angle, Content.Angle);
            EditorGUILayout.PropertyField(properties.Factor, Content.Factor);
            EditorGUILayout.PropertyField(properties.Mode, Content.Mode);

            using (new EditorGUI.IndentLevelScope())
            {
                EditorGUILayout.PropertyField(properties.Bounds, Content.Bounds);
            }

            EditorGUILayout.PropertyField(properties.Axis, Content.Axis);

            serializedObject.ApplyModifiedProperties();

            EditorGUILayoutx.WIPAlert();

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 21
0
    /** Draws an integer field */
    public int IntField(GUIContent label, int value, int offset, int adjust, out Rect r, out bool selected)
    {
        GUIStyle intStyle = EditorStyles.numberField;

        EditorGUILayoutx.BeginIndent();
        Rect r1 = GUILayoutUtility.GetRect(label, intStyle);

        Rect r2 = GUILayoutUtility.GetRect(new GUIContent(value.ToString()), intStyle);

        EditorGUILayoutx.EndIndent();


        r2.width += (r2.x - r1.x);
        r2.x      = r1.x + offset;
        r2.width -= offset + offset + adjust;

        r        = new Rect();
        r.x      = r2.x + r2.width;
        r.y      = r1.y;
        r.width  = offset;
        r.height = r1.height;

        GUI.SetNextControlName("IntField_" + label.text);
        value = EditorGUI.IntField(r2, "", value);

        bool on = GUI.GetNameOfFocusedControl() == "IntField_" + label.text;

        selected = on;

        if (Event.current.type == EventType.Repaint)
        {
            intStyle.Draw(r1, label, false, false, false, on);
        }

        return(value);
    }
Exemplo n.º 22
0
        protected virtual void DrawDebugInfo()
        {
            if (foldoutDebug = EditorGUILayoutx.FoldoutHeader("Debug Info", foldoutDebug))
            {
                var vertexCount  = 0;
                var modifiedData = DataFlags.None;
                var bounds       = (target as Deformable).GetCurrentMesh().bounds;
                foreach (var t in targets)
                {
                    var deformable = t as Deformable;
                    var mesh       = deformable.GetMesh();

                    if (mesh != null)
                    {
                        vertexCount += deformable.GetMesh().vertexCount;
                    }
                    modifiedData |= deformable.ModifiedDataFlags;
                }

                EditorGUILayout.LabelField($"Vertex Count: {vertexCount}", Styles.WrappedLabel);
                EditorGUILayout.LabelField($"Modified Data: {modifiedData.ToString()}", Styles.WrappedLabel);
                EditorGUILayout.LabelField($"Bounds: {bounds.ToString()}", Styles.WrappedLabel);
            }
        }
Exemplo n.º 23
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();


        //Do some loading and checking
        if (!AstarPathEditor.stylesLoaded)
        {
            if (!AstarPathEditor.LoadStyles())
            {
                if (AstarPathEditor.upArrow == null)
                {
                    AstarPathEditor.upArrow   = GUI.skin.FindStyle("Button");
                    AstarPathEditor.downArrow = AstarPathEditor.upArrow;
                }
            }
            else
            {
                AstarPathEditor.stylesLoaded = true;
            }
        }
        GUIStyle helpBox = GUI.skin.GetStyle("helpBox");

        Seeker script = target as Seeker;

        if (mods == null)
        {
            mods = new List <IPathModifier>(script.GetComponents <MonoModifier>() as IPathModifier[]);
        }
        else
        {
            mods.Clear();
            mods.AddRange(script.GetComponents <MonoModifier>() as IPathModifier[]);
        }

        mods.Add(script.startEndModifier as IPathModifier);

        bool changed = true;

        while (changed)
        {
            changed = false;
            for (int i = 0; i < mods.Count - 1; i++)
            {
                if (mods[i].Priority < mods[i + 1].Priority)
                {
                    IPathModifier tmp = mods[i + 1];
                    mods[i + 1] = mods[i];
                    mods[i]     = tmp;
                    changed     = true;
                }
            }
        }

        for (int i = 0; i < mods.Count; i++)
        {
            if (mods.Count - i != mods[i].Priority)
            {
                mods[i].Priority = mods.Count - i;
                GUI.changed      = true;
                EditorUtility.SetDirty(target);
            }
        }

        bool modifierErrors = false;

        for (int i = 1; i < mods.Count; i++)
        {
            if (!ModifierConverter.CanConvert(mods[i - 1].output, mods[i].input))
            {
                modifierErrors = true;
            }
        }

        EditorGUI.indentLevel = 0;

        modifiersOpen = EditorGUILayout.Foldout(modifiersOpen, "Modifiers Priorities" + (modifierErrors ? " - Errors in modifiers!" : ""), EditorStyles.foldout);

        EditorGUI.indentLevel = 1;

        if (modifiersOpen)
        {
            EditorGUI.indentLevel += 2;

            //GUILayout.BeginHorizontal ();
            //GUILayout.Space (28);
            if (GUILayout.Button("Modifiers attached to this gameObject are listed here.\nModifiers with a higher priority (higher up in the list) will be executed first.\nClick here for more info", helpBox))
            {
                Application.OpenURL(AstarPathEditor.ModifierHelpURL);
            }
            //GUILayout.EndHorizontal ();

            for (int i = 0; i < mods.Count; i++)
            {
                //EditorGUILayout.LabelField (mods[i].GetType ().ToString (),mods[i].Priority.ToString ());

                GUILayout.BeginVertical(GUI.skin.box);

                if (i > 0)
                {
                    if (!ModifierConverter.CanConvert(mods[i - 1].output, mods[i].input))
                    {
                        //GUILayout.BeginHorizontal ();
                        //GUILayout.Space (28);
                        GUIUtilityx.SetColor(new Color(0.8F, 0, 0));
                        GUILayout.Label("Cannot convert " + mods[i - 1].GetType().Name + "'s output to " + mods[i].GetType().Name + "'s input\nRearranging the modifiers might help", EditorStyles.whiteMiniLabel);
                        GUIUtilityx.ResetColor();
                        //GUILayout.EndHorizontal ();
                    }
                }

                GUILayout.Label("Input: " + mods[i].input, EditorStyles.wordWrappedMiniLabel);
                int newPrio = EditorGUILayoutx.UpDownArrows(new GUIContent(ObjectNames.NicifyVariableName(mods[i].GetType().ToString())), mods[i].Priority, EditorStyles.label, AstarPathEditor.upArrow, AstarPathEditor.downArrow);

                GUILayout.Label("Output: " + mods[i].output, EditorStyles.wordWrappedMiniLabel);

                GUILayout.EndVertical();

                int diff = newPrio - mods[i].Priority;

                if (i > 0 && diff > 0)
                {
                    mods[i - 1].Priority = mods[i].Priority;
                }
                else if (i < mods.Count - 1 && diff < 0)
                {
                    mods[i + 1].Priority = mods[i].Priority;
                }

                mods[i].Priority = newPrio;
            }

            EditorGUI.indentLevel -= 2;
        }
    }
Exemplo n.º 24
0
    //End Misc
    /** Enables editor stuff. Loads graphs, reads settings and sets everything up */
    public void OnEnable()
    {
        script = target as AstarPath;
        GUILayoutx = new EditorGUILayoutx ();
        EditorGUILayoutx.editor = this;

        AstarSerializer.readUnityReference_Editor  = ReadUnityReference;
        AstarSerializer.writeUnityReference_Editor = WriteUnityReference;

        //Enables the editor to get a callback on OnDrawGizmos to enable graph editors to draw gizmos
        script.OnDrawGizmosCallback = OnDrawGizmos;

        // Make sure all references are set up to avoid NullReferenceExceptions
        script.SetUpReferences ();

        //Search the assembly for graph types and graph editors
        FindGraphTypes ();

        GetAstarEditorSettings ();

        LoadStyles ();

        LoadGraphs ();
    }
Exemplo n.º 25
0
    public override void OnInspectorGUI(NavGraph target)
    {
        GridGraph graph = target as GridGraph;

        //GUILayout.BeginHorizontal ();
        //GUILayout.BeginVertical ();
        Rect lockRect;
        Rect tmpLockRect;

        GUIStyle lockStyle = AstarPathEditor.astarSkin.FindStyle("GridSizeLock");

        if (lockStyle == null)
        {
            lockStyle = new GUIStyle();
        }

        bool sizeSelected1 = false;
        bool sizeSelected2 = false;

#if UNITY_4
        int newWidth = IntField(new GUIContent("Width (nodes)", "Width of the graph in nodes"), graph.width, 100, 0, out lockRect, out sizeSelected1);
        int newDepth = IntField(new GUIContent("Depth (nodes)", "Depth (or height you might also call it) of the graph in nodes"), graph.depth, 100, 0, out tmpLockRect, out sizeSelected2);
#else
        int newWidth = IntField(new GUIContent("Width (nodes)", "Width of the graph in nodes"), graph.width, 50, 0, out lockRect, out sizeSelected1);
        int newDepth = IntField(new GUIContent("Depth (nodes)", "Depth (or height you might also call it) of the graph in nodes"), graph.depth, 50, 0, out tmpLockRect, out sizeSelected2);
#endif

        //Rect r = GUILayoutUtility.GetRect (0,0,lockStyle);

        lockRect.width  = lockStyle.fixedWidth;
        lockRect.height = lockStyle.fixedHeight;
        lockRect.x     += lockStyle.margin.left;
        lockRect.y     += lockStyle.margin.top;

        locked = GUI.Toggle(lockRect, locked, new GUIContent("", "If the width and depth values are locked, changing the node size will scale the grid which keeping the number of nodes consistent instead of keeping the size the same and changing the number of nodes in the graph"), lockStyle);

        //GUILayout.EndHorizontal ();

        if (newWidth != graph.width || newDepth != graph.depth)
        {
            SnapSizeToNodes(newWidth, newDepth, graph);
        }

        GUI.SetNextControlName("NodeSize");
        newNodeSize = EditorGUILayout.FloatField(new GUIContent("Node size", "The size of a single node. The size is the side of the node square in world units"), graph.nodeSize);

        newNodeSize = newNodeSize <= 0.01F ? 0.01F : newNodeSize;

        float prevRatio = graph.aspectRatio;
        graph.aspectRatio = EditorGUILayout.FloatField(new GUIContent("Aspect Ratio", "Scaling of the nodes width/depth ratio. Good for isometric games"), graph.aspectRatio);


        //if ((GUI.GetNameOfFocusedControl () != "NodeSize" && Event.current.type == EventType.Repaint) || Event.current.keyCode == KeyCode.Return) {

        //Debug.Log ("Node Size Not Selected " + Event.current.type);

        if (graph.nodeSize != newNodeSize || prevRatio != graph.aspectRatio)
        {
            if (!locked)
            {
                graph.nodeSize = newNodeSize;
                Matrix4x4 oldMatrix = graph.matrix;
                graph.GenerateMatrix();
                if (graph.matrix != oldMatrix)
                {
                    //Rescann the graphs
                    //AstarPath.active.AutoScan ();
                    GUI.changed = true;
                }
            }
            else
            {
                float delta = newNodeSize / graph.nodeSize;
                graph.nodeSize      = newNodeSize;
                graph.unclampedSize = new Vector2(newWidth * graph.nodeSize, newDepth * graph.nodeSize);
                Vector3 newCenter = graph.matrix.MultiplyPoint3x4(new Vector3((newWidth / 2F) * delta, 0, (newDepth / 2F) * delta));
                graph.center = newCenter;
                graph.GenerateMatrix();

                //Make sure the width & depths stay the same
                graph.width = newWidth;
                graph.depth = newDepth;
                AstarPath.active.AutoScan();
            }
        }
        //}

        Vector3 pivotPoint;
        Vector3 diff;

        EditorGUIUtility.LookLikeControls();
#if !UNITY_4
        EditorGUILayoutx.BeginIndent();
#else
        GUILayout.BeginHorizontal();
#endif

        switch (pivot)
        {
        case GridPivot.Center:
            graph.center = EditorGUILayout.Vector3Field("Center", graph.center);
            break;

        case GridPivot.TopLeft:
            pivotPoint   = graph.matrix.MultiplyPoint3x4(new Vector3(0, 0, graph.depth));
            diff         = pivotPoint - graph.center;
            pivotPoint   = EditorGUILayout.Vector3Field("Top-Left", pivotPoint);
            graph.center = pivotPoint - diff;
            break;

        case GridPivot.TopRight:
            pivotPoint   = graph.matrix.MultiplyPoint3x4(new Vector3(graph.width, 0, graph.depth));
            diff         = pivotPoint - graph.center;
            pivotPoint   = EditorGUILayout.Vector3Field("Top-Right", pivotPoint);
            graph.center = pivotPoint - diff;
            break;

        case GridPivot.BottomLeft:
            pivotPoint   = graph.matrix.MultiplyPoint3x4(new Vector3(0, 0, 0));
            diff         = pivotPoint - graph.center;
            pivotPoint   = EditorGUILayout.Vector3Field("Bottom-Left", pivotPoint);
            graph.center = pivotPoint - diff;
            break;

        case GridPivot.BottomRight:
            pivotPoint   = graph.matrix.MultiplyPoint3x4(new Vector3(graph.width, 0, 0));
            diff         = pivotPoint - graph.center;
            pivotPoint   = EditorGUILayout.Vector3Field("Bottom-Right", pivotPoint);
            graph.center = pivotPoint - diff;
            break;
        }

        graph.GenerateMatrix();

        pivot = PivotPointSelector(pivot);

#if !UNITY_4
        EditorGUILayoutx.EndIndent();

        EditorGUILayoutx.BeginIndent();
#else
        GUILayout.EndHorizontal();
#endif

        graph.rotation = EditorGUILayout.Vector3Field("Rotation", graph.rotation);
        //Add some space to make the Rotation and postion fields be better aligned (instead of the pivot point selector)
        GUILayout.Space(19 + 7);
        //GUILayout.EndHorizontal ();

#if !UNITY_4
        EditorGUILayoutx.EndIndent();
#endif
        EditorGUIUtility.LookLikeInspector();

        if (GUILayout.Button(new GUIContent("Snap Size", "Snap the size to exactly fit nodes"), GUILayout.MaxWidth(100), GUILayout.MaxHeight(16)))
        {
            SnapSizeToNodes(newWidth, newDepth, graph);
        }

        Separator();

        graph.cutCorners = EditorGUILayout.Toggle(new GUIContent("Cut Corners", "Enables or disables cutting corners. See docs for image example"), graph.cutCorners);
        graph.neighbours = (NumNeighbours)EditorGUILayout.EnumPopup(new GUIContent("Connections", "Sets how many connections a node should have to it's neighbour nodes."), graph.neighbours);

        //GUILayout.BeginHorizontal ();
        //EditorGUILayout.PrefixLabel ("Max Climb");
        graph.maxClimb = EditorGUILayout.FloatField(new GUIContent("Max Climb", "How high, relative to the graph, should a climbable level be. A zero (0) indicates infinity"), graph.maxClimb);
        EditorGUI.indentLevel++;
        graph.maxClimbAxis = EditorGUILayout.IntPopup(new GUIContent("Climb Axis", "Determines which axis the above setting should test on"), graph.maxClimbAxis, new GUIContent[3] {
            new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z")
        }, new int[3] {
            0, 1, 2
        });

        EditorGUI.indentLevel--;
        //GUILayout.EndHorizontal ();

        graph.maxSlope = EditorGUILayout.Slider(new GUIContent("Max Slope", "Sets the max slope in degrees for a point to be walkable. Only enabled if Height Testing is enabled."), graph.maxSlope, 0, 90F);

        graph.erodeIterations = EditorGUILayout.IntField(new GUIContent("Erode iterations", "Sets how many times the graph should be eroded. This adds extra margin to objects. This will not work when using Graph Updates, so if you can, use the Diameter setting in collision settings instead"), graph.erodeIterations);
        graph.erodeIterations = graph.erodeIterations > 16 ? 16 : graph.erodeIterations;         //Clamp iterations to 16

        graph.erosionUseTags = EditorGUILayout.Toggle(new GUIContent("Erosion Uses Tags", "Instead of making nodes unwalkable, " +
                                                                     "nodes will have their tag set to a value corresponding to their erosion level, " +
                                                                     "which is a quite good measurement of their distance to the closest wall."),
                                                      graph.erosionUseTags);
        if (graph.erosionUseTags)
        {
            EditorGUI.indentLevel++;
            graph.erosionFirstTag = EditorGUILayoutx.SingleTagField("First Tag", graph.erosionFirstTag);
            EditorGUI.indentLevel--;
        }

        DrawCollisionEditor(graph.collision);

        Separator();

        showExtra = EditorGUILayout.Foldout(showExtra, "Extra");

        if (showExtra)
        {
            EditorGUI.indentLevel += 2;

            graph.penaltyAngle = ToggleGroup(new GUIContent("Angle Penalty", "Adds a penalty based on the slope of the node"), graph.penaltyAngle);
            //bool preGUI = GUI.enabled;
            //GUI.enabled = graph.penaltyAngle && GUI.enabled;
            if (graph.penaltyAngle)
            {
                EditorGUI.indentLevel++;
                graph.penaltyAngleFactor = EditorGUILayout.FloatField(new GUIContent("Factor", "Scale of the penalty. A negative value should not be used"), graph.penaltyAngleFactor);
                //GUI.enabled = preGUI;
                HelpBox("Applies penalty to nodes based on the angle of the hit surface during the Height Testing");

                EditorGUI.indentLevel--;
            }

            graph.penaltyPosition = ToggleGroup("Position Penalty", graph.penaltyPosition);
            //EditorGUILayout.Toggle ("Position Penalty",graph.penaltyPosition);
            //preGUI = GUI.enabled;
            //GUI.enabled = graph.penaltyPosition && GUI.enabled;
            if (graph.penaltyPosition)
            {
                EditorGUI.indentLevel++;
                graph.penaltyPositionOffset = EditorGUILayout.FloatField("Offset", graph.penaltyPositionOffset);
                graph.penaltyPositionFactor = EditorGUILayout.FloatField("Factor", graph.penaltyPositionFactor);
                HelpBox("Applies penalty to nodes based on their Y coordinate\nSampled in Int3 space, i.e it is multiplied with Int3.Precision first (" + Int3.Precision + ")\n" +
                        "Be very careful when using negative values since a negative penalty will underflow and instead get really high");
                //GUI.enabled = preGUI;
                EditorGUI.indentLevel--;
            }

            if (textureVisible)
            {
                DrawTextureData(graph.textureData, graph);
            }
            EditorGUI.indentLevel -= 2;
        }
    }
Exemplo n.º 26
0
        public override void OnInspectorGUI()
        {
            serializedObject.UpdateIfRequiredOrScript();
            using (var check = new EditorGUI.ChangeCheckScope())
            {
                EditorGUILayout.PropertyField(properties.UpdateMode, Content.UpdateMode);
                if (check.changed)
                {
                    serializedObject.ApplyModifiedProperties();
                    foreach (var t in targets)
                    {
                        ((Deformable)t).UpdateMode = (UpdateMode)properties.UpdateMode.enumValueIndex;
                    }
                }
            }

            EditorGUILayout.PropertyField(properties.NormalsRecalculation, Content.NormalsRecalculation);
            EditorGUILayout.PropertyField(properties.BoundsRecalculation, Content.BoundsRecalculation);

            if (properties.BoundsRecalculation.hasMultipleDifferentValues || (BoundsRecalculation)properties.BoundsRecalculation.enumValueIndex == BoundsRecalculation.Custom)
            {
                using (new EditorGUI.IndentLevelScope())
                {
                    EditorGUILayout.PropertyField(properties.CustomBounds, Content.CustomBounds);
                }
            }

            EditorGUILayout.PropertyField(properties.ColliderRecalculation, Content.ColliderRecalculation);
            if (properties.ColliderRecalculation.hasMultipleDifferentValues || (ColliderRecalculation)properties.ColliderRecalculation.enumValueIndex == ColliderRecalculation.Auto)
            {
                using (new EditorGUI.IndentLevelScope())
                    EditorGUILayout.PropertyField(properties.MeshCollider, Content.MeshCollider);
            }

            EditorGUILayout.Space();

            deformerList.DoLayoutList();

            var newDeformers = EditorGUILayoutx.DragAndDropArea <Deformer> ();

            if (newDeformers != null && newDeformers.Count > 0)
            {
                Undo.RecordObjects(targets, "Added Deformers");
                foreach (var t in targets)
                {
                    var elements = ((Deformable)t).DeformerElements;
                    foreach (var newDeformer in newDeformers)
                    {
                        elements.Add(new DeformerElement(newDeformer));
                    }
                }

                // I'd like to give a massive thanks and credit to Thomas Ingram for taking time out of his day to
                // solve an abomination of a bug and find this fix. He truly is an editor scripting legend.
                // Changing fields directly with multiple objects selected doesn't dirty the serialized object for some reason.
                // To force it to be dirty you have to call this method.
                serializedObject.SetIsDifferentCacheDirty();
                serializedObject.Update();
            }

            EditorGUILayout.Space();

            using (new EditorGUILayout.HorizontalScope())
            {
                var selectedIndex = GUILayout.Toolbar(-1, Content.UtilityToolbar, EditorStyles.miniButton, GUILayout.MinWidth(0));
                switch (selectedIndex)
                {
                default:
                    throw new System.ArgumentException($"No valid action for toolbar index {selectedIndex}.");

                case -1:
                    break;

                case 0:
                    Undo.RecordObjects(targets, "Cleared Deformers");
                    foreach (var t in targets)
                    {
                        ((Deformable)t).DeformerElements.Clear();
                    }
                    break;

                case 1:
                    Undo.RecordObjects(targets, "Cleaned Deformers");
                    foreach (var t in targets)
                    {
                        ((Deformable)t).DeformerElements.RemoveAll(d => d.Component == null);
                    }
                    break;

                case 2:
                    foreach (var t in targets)
                    {
                        var deformable = t as Deformable;

                        // C:/...<ProjectName>/Assets/
                        var projectPath = Application.dataPath + "/";
                        var assetPath   = EditorUtility.SaveFilePanelInProject("Save Obj", $"{deformable.name}.obj", "obj", "");
                        if (string.IsNullOrEmpty(assetPath))
                        {
                            break;
                        }
                        var fileName = assetPath;
                        // Now that we have a unique asset path we can remove the "Assets/" and ".obj" to get the unique name.
                        // It's pretty gross, but it works and this code doesn't need to be performant.
                        fileName = fileName.Remove(0, 7);
                        fileName = fileName.Remove(fileName.Length - 4, 4);

                        ObjExporter.SaveMesh(deformable.GetMesh(), deformable.GetRenderer(), projectPath, fileName);
                        AssetDatabase.Refresh(ImportAssetOptions.ForceSynchronousImport);
                    }
                    break;

                case 3:
                    foreach (var t in targets)
                    {
                        var deformable = t as Deformable;

                        var assetPath = EditorUtility.SaveFilePanelInProject("Save Mesh Asset", $"{deformable.name}.asset", "asset", "");
                        if (string.IsNullOrEmpty(assetPath))
                        {
                            break;
                        }

                        AssetDatabase.CreateAsset(Instantiate(deformable.GetMesh()), assetPath);
                        AssetDatabase.SaveAssets();
                    }
                    break;
                }
            }

            EditorGUILayout.Space();

            if (foldoutDebug = EditorGUILayoutx.FoldoutHeader("Debug Info", foldoutDebug))
            {
                var vertexCount  = 0;
                var modifiedData = DataFlags.None;
                var bounds       = (target as Deformable).GetMesh().bounds;
                foreach (var t in targets)
                {
                    var deformable = t as Deformable;
                    var mesh       = deformable.GetMesh();

                    if (mesh != null)
                    {
                        vertexCount += deformable.GetMesh().vertexCount;
                    }
                    modifiedData |= deformable.ModifiedDataFlags;
                }

                EditorGUILayout.LabelField($"Vertex Count: {vertexCount}", Styles.WrappedLabel);
                EditorGUILayout.LabelField($"Modified Data: {modifiedData.ToString ()}", Styles.WrappedLabel);
                EditorGUILayout.LabelField($"Bounds: {bounds.ToString ()}", Styles.WrappedLabel);
            }

            serializedObject.ApplyModifiedProperties();

            foreach (var t in targets)
            {
                var deformable = t as Deformable;

                var originalMesh = deformable.GetOriginalMesh();
                if (originalMesh != null && !originalMesh.isReadable)
                {
                    EditorGUILayout.HelpBox(Content.ReadWriteNotEnableAlert, MessageType.Error);
                }
            }

            EditorApplication.QueuePlayerLoopUpdate();
        }
Exemplo n.º 27
0
        private void OnGUI()
        {
            EditorGUILayout.Space();

            if (GUILayout.Button(Content.CreateDeformable, Styles.Button))
            {
                AddOrCreateDeformable();
            }

            using (new EditorGUILayout.HorizontalScope())
            {
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var rect = GUILayoutUtility.GetRect(1, 1, 18, 18, GUILayout.ExpandWidth(true));
                    rect.width -= Styles.PAD_X * 2;
                    rect.x     += Styles.PAD_X;
                    rect.y     += Styles.PAD_Y * 2;

                    var newSearchQuery = searchField.OnToolbarGUI(rect, searchQuery);
                    if (check.changed)
                    {
                        Undo.RecordObject(this, "Changed Search Query");
                        searchQuery = newSearchQuery;
                    }
                }
            }

            EditorGUILayout.Space();

            using (var scroll = new EditorGUILayout.ScrollViewScope(scrollPosition))
            {
                if (deformerAttributes == null || deformerAttributes.Count == 0)
                {
                    EditorGUILayout.LabelField("No deformers found.", GUILayout.MinWidth(0));
                }
                else
                {
                    filteredDeformerAttributes =
                        (
                            from d in deformerAttributes
                            where string.IsNullOrEmpty(searchQuery) || d.Name.ToLower().Contains(searchQuery.ToLower())
                            select d
                        ).ToList();

                    var drawnCount = 0;
                    for (int i = 0; i < filteredDeformerAttributes.Count; i++)
                    {
                        var current = filteredDeformerAttributes[i];

                        if (drawnCount == 0)
                        {
                            var countInCategory = filteredDeformerAttributes.Count(t => t.Category == current.Category);
                            categoryFoldouts[current.Category] = EditorGUILayoutx.FoldoutHeader($"{current.Category.ToString ()} ({countInCategory})", categoryFoldouts[current.Category], EditorStyles.label);
                        }

                        if (categoryFoldouts[current.Category])
                        {
                            if (GUILayout.Button(new GUIContent(current.Name, current.Description), Styles.Button))
                            {
                                CreateDeformerFromAttribute(current, Event.current.modifiers != EventModifiers.Alt);
                            }
                        }

                        drawnCount++;

                        if (i + 1 < filteredDeformerAttributes.Count)
                        {
                            var next = filteredDeformerAttributes[i + 1];
                            if (next.Category != current.Category)
                            {
                                var countInCategory = filteredDeformerAttributes.Count(t => t.Category == next.Category);
                                categoryFoldouts[next.Category] = EditorGUILayoutx.FoldoutHeader($"{next.Category.ToString ()} ({countInCategory})", categoryFoldouts[next.Category], EditorStyles.label);
                            }
                        }
                    }

                    EditorGUILayout.Space();
                }
                scrollPosition = scroll.scrollPosition;
            }
        }
	//End Misc


	/** Enables editor stuff. Loads graphs, reads settings and sets everything up */
	public void OnEnable () {

		script = target as AstarPath;
		guiLayoutx = new EditorGUILayoutx ();
		EditorGUILayoutx.editor = this;

		// Enables the editor to get a callback on OnDrawGizmos to enable graph editors to draw gizmos
		script.OnDrawGizmosCallback = OnDrawGizmos;

		// Register to the OnUnloadGizmoMeshes event
		// Make sure that if any previous subscriber (another instance of this editor likely) gets a final event
		if (script.OnUnloadGizmoMeshes != null && script.OnUnloadGizmoMeshes != UnloadGizmoMeshes) script.OnUnloadGizmoMeshes();
		script.OnUnloadGizmoMeshes = UnloadGizmoMeshes;

		// Make sure all references are set up to avoid NullReferenceExceptions
		script.SetUpReferences ();

		Undo.undoRedoPerformed += OnUndoRedoPerformed;

		// Search the assembly for graph types and graph editors
		if ( graphEditorTypes == null || graphEditorTypes.Count == 0 )
			FindGraphTypes ();

		try {
			GetAstarEditorSettings ();
		} catch (System.Exception e) {
			Debug.LogException ( e );
		}

		LoadStyles ();

		// Load graphs only when not playing, or in extreme cases, when astarData.graphs is null
		if ((!Application.isPlaying && (script.astarData == null || script.astarData.graphs == null || script.astarData.graphs.Length == 0)) || script.astarData.graphs == null) {
			LoadGraphs ();
		}
	}
 protected override void DrawHelpBoxes()
 {
     base.DrawHelpBoxes();
     EditorGUILayoutx.WIPAlert();
 }
Exemplo n.º 30
0
	//End Misc
	
	
	/** Enables editor stuff. Loads graphs, reads settings and sets everything up */
	public void OnEnable () {
		
		script = target as AstarPath;
		GUILayoutx = new EditorGUILayoutx ();
		EditorGUILayoutx.editor = this;
		
		AstarSerializer.readUnityReference_Editor  = ReadUnityReference;
		AstarSerializer.writeUnityReference_Editor = WriteUnityReference;
		
		//Enables the editor to get a callback on OnDrawGizmos to enable graph editors to draw gizmos
		script.OnDrawGizmosCallback = OnDrawGizmos;
		
		// Make sure all references are set up to avoid NullReferenceExceptions
		script.SetUpReferences ();
		
		//Search the assembly for graph types and graph editors
		FindGraphTypes ();
		
		GetAstarEditorSettings ();
		
		LoadStyles ();
		
		//Load graphs only when not playing, or in extreme cases, when astarData.graphs is null
		if ((!Application.isPlaying && (script.astarData == null || script.astarData.graphs == null || script.astarData.graphs.Length == 0)) || script.astarData.graphs == null) {
			LoadGraphs ();
		}
	}
Exemplo n.º 31
0
    public override void OnInspectorGUI()
    {
        GraphUpdateScene script = target as GraphUpdateScene;

        if (script.points == null)
        {
            script.points = new Vector3[0];
        }

        Vector3[] prePoints = script.points;
        DrawDefaultInspector();
        EditorGUI.indentLevel = 1;

        if (prePoints != script.points)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        bool preConvex = script.convex;

        script.convex = EditorGUILayout.Toggle(new GUIContent("Convex", "Sets if only the convex hull of the points should be used or the whole polygon"), script.convex);
        if (script.convex != preConvex)
        {
            script.RecalcConvex(); HandleUtility.Repaint();
        }

        script.applyOnStart = EditorGUILayout.Toggle("Apply On Start", script.applyOnStart);
        script.applyOnScan  = EditorGUILayout.Toggle("Apply On Scan", script.applyOnScan);

        script.modifyWalkability = EditorGUILayout.Toggle("Modify walkability", script.modifyWalkability);
        if (script.modifyWalkability)
        {
            EditorGUI.indentLevel++;
            script.setWalkability = EditorGUILayout.Toggle("Walkability", script.setWalkability);
            EditorGUI.indentLevel--;
        }

        script.penalty = EditorGUILayout.IntField("Penalty", script.penalty);

#if ConfigureTagsAsMultiple
        script.modifyTag = EditorGUILayout.Toggle(new GUIContent("Modify Tags", "Should the tags of the nodes be modified"), script.modifyTag);
        EditorGUILayoutx.TagsMaskField(new GUIContent("Tags Change", "Which tags to change the value of. The values the tags will gain can be set below"), new GUIContent("Tags Set", "What to set the tag to if it is going to be changed"), ref script.tags);
#else
        script.modifyTag = EditorGUILayout.Toggle(new GUIContent("Modify Tags", "Should the tags of the nodes be modified"), script.modifyTag);
        if (script.modifyTag)
        {
            EditorGUI.indentLevel++;
            script.setTag = EditorGUILayout.Popup("Set Tag", script.setTag, AstarPath.FindTagNames());
            EditorGUI.indentLevel--;
        }
#endif

        //GUI.color = Color.red;
        if (GUILayout.Button("Tags can be used to restrict which units can walk on what ground. Click here for more info", "HelpBox"))
        {
            Application.OpenURL(AstarPathEditor.GetURL("tags"));
        }

        //GUI.color = Color.white;

        if (GUILayout.Button("Clear all points"))
        {
            Undo.RegisterUndo(script, "Removed All Points");
            script.points = new Vector3[0];
            script.RecalcConvex();
        }

        if (GUI.changed)
        {
            EditorUtility.SetDirty(target);
        }
    }
Exemplo n.º 32
0
        private void OnGUI()
        {
            var sceneExpandedProperty = serializedAsset.FindProperty(nameof(DeformEditorSettingsAsset.dottedLineSize));

            if (sceneExpandedProperty.isExpanded = EditorGUILayoutx.FoldoutHeader("Scene", sceneExpandedProperty.isExpanded))
            {
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var solidColor = EditorGUILayout.ColorField(Content.SolidHandleColor, DeformEditorSettings.SolidHandleColor);
                    if (check.changed)
                    {
                        Undo.RecordObject(DeformEditorSettings.SettingsAsset, "Changed Solid Color Settings");
                        DeformEditorSettings.SolidHandleColor = solidColor;
                    }
                }
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var lightColor = EditorGUILayout.ColorField(Content.LightHandleColor, DeformEditorSettings.LightHandleColor);
                    if (check.changed)
                    {
                        Undo.RecordObject(DeformEditorSettings.SettingsAsset, "Changed Light Color Settings");
                        DeformEditorSettings.LightHandleColor = lightColor;
                    }
                }
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var dottedLineSize = EditorGUILayout.FloatField(Content.DottedLineSize, DeformEditorSettings.DottedLineSize);
                    if (check.changed)
                    {
                        Undo.RecordObject(DeformEditorSettings.SettingsAsset, "Changed Dotted Line Size Settings");
                        DeformEditorSettings.DottedLineSize = dottedLineSize;
                    }
                }
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var handleSize = EditorGUILayout.FloatField(Content.ScreenspaceSliderHandleCapSize, DeformEditorSettings.ScreenspaceSliderHandleCapSize);
                    if (check.changed)
                    {
                        Undo.RecordObject(DeformEditorSettings.SettingsAsset, "Changed Handle Size Settings");
                        DeformEditorSettings.ScreenspaceSliderHandleCapSize = handleSize;
                    }
                }
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var angleHandleSize = EditorGUILayout.FloatField(Content.ScreenspaceAngleHandleSize, DeformEditorSettings.ScreenspaceAngleHandleSize);
                    if (check.changed)
                    {
                        Undo.RecordObject(DeformEditorSettings.SettingsAsset, "Changed Angle Handle Size Settings");
                        DeformEditorSettings.ScreenspaceAngleHandleSize = angleHandleSize;
                    }
                }
            }

            var importerExpandedProperty = serializedAsset.FindProperty(nameof(DeformEditorSettingsAsset.modelsReadableByDefault));

            if (importerExpandedProperty.isExpanded = EditorGUILayoutx.FoldoutHeader("Importer", importerExpandedProperty.isExpanded))
            {
                using (var check = new EditorGUI.ChangeCheckScope())
                {
                    var modelsReadableByDefault = EditorGUILayout.Toggle(Content.ModelsReadableByDefault, DeformEditorSettings.ModelsReadableByDefault);
                    if (check.changed)
                    {
                        Undo.RecordObject(DeformEditorSettings.SettingsAsset, "Changed Models Readable By Default");
                        DeformEditorSettings.ModelsReadableByDefault = modelsReadableByDefault;
                    }
                }
            }
        }
Exemplo n.º 33
0
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        Seeker script = target as Seeker;

#if !UNITY_LE_4_3
        Undo.RecordObject(script, "modify settings on Seeker");
#endif

        EditorGUILayoutx.SetTagField(new GUIContent("Valid Tags"), ref script.traversableTags);

#if !ASTAR_NoTagPenalty
        EditorGUI.indentLevel = 0;
        tagPenaltiesOpen      = EditorGUILayout.Foldout(tagPenaltiesOpen, new GUIContent("Tag Penalties", "Penalties for each tag"));
        if (tagPenaltiesOpen)
        {
            EditorGUI.indentLevel = 2;
            string[] tagNames = AstarPath.FindTagNames();
            for (int i = 0; i < script.tagPenalties.Length; i++)
            {
                int tmp = EditorGUILayout.IntField((i < tagNames.Length ? tagNames[i] : "Tag " + i), (int)script.tagPenalties[i]);
                if (tmp < 0)
                {
                    tmp = 0;
                }
                script.tagPenalties[i] = tmp;
            }
            if (GUILayout.Button("Edit Tag Names..."))
            {
                AstarPathEditor.EditTags();
            }
        }
        EditorGUI.indentLevel = 1;
#endif

        //Do some loading and checking
        if (!AstarPathEditor.stylesLoaded)
        {
            if (!AstarPathEditor.LoadStyles())
            {
                if (AstarPathEditor.upArrow == null)
                {
                    AstarPathEditor.upArrow   = GUI.skin.FindStyle("Button");
                    AstarPathEditor.downArrow = AstarPathEditor.upArrow;
                }
            }
            else
            {
                AstarPathEditor.stylesLoaded = true;
            }
        }

        GUIStyle helpBox = GUI.skin.GetStyle("helpBox");


        if (mods == null)
        {
            mods = new List <IPathModifier>(script.GetComponents <MonoModifier>() as IPathModifier[]);
        }
        else
        {
            mods.Clear();
            mods.AddRange(script.GetComponents <MonoModifier>() as IPathModifier[]);
        }

        mods.Add(script.startEndModifier as IPathModifier);

        bool changed = true;
        while (changed)
        {
            changed = false;
            for (int i = 0; i < mods.Count - 1; i++)
            {
                if (mods[i].Priority < mods[i + 1].Priority)
                {
                    IPathModifier tmp = mods[i + 1];
                    mods[i + 1] = mods[i];
                    mods[i]     = tmp;
                    changed     = true;
                }
            }
        }

        for (int i = 0; i < mods.Count; i++)
        {
            if (mods.Count - i != mods[i].Priority)
            {
                mods[i].Priority = mods.Count - i;
                GUI.changed      = true;
                EditorUtility.SetDirty(target);
            }
        }

        bool modifierErrors = false;

        IPathModifier prevMod = mods[0];

        //Loops through all modifiers and checks if there are any errors in converting output between modifiers
        for (int i = 1; i < mods.Count; i++)
        {
            MonoModifier monoMod = mods[i] as MonoModifier;
            if ((prevMod as MonoModifier) != null && !(prevMod as MonoModifier).enabled)
            {
                if (monoMod == null || monoMod.enabled)
                {
                    prevMod = mods[i];
                }
                continue;
            }

            if ((monoMod == null || monoMod.enabled) && prevMod != mods[i] && !ModifierConverter.CanConvert(prevMod.output, mods[i].input))
            {
                modifierErrors = true;
            }

            if (monoMod == null || monoMod.enabled)
            {
                prevMod = mods[i];
            }
        }

        EditorGUI.indentLevel = 0;

#if UNITY_LE_4_3
        modifiersOpen = EditorGUILayout.Foldout(modifiersOpen, "Modifiers Priorities" + (modifierErrors ? " - Errors in modifiers!" : ""), EditorStyles.foldout);
#else
        modifiersOpen = EditorGUILayout.Foldout(modifiersOpen, "Modifiers Priorities" + (modifierErrors ? " - Errors in modifiers!" : ""));
#endif

#if UNITY_LE_4_3
        EditorGUI.indentLevel = 1;
#endif

        if (modifiersOpen)
        {
#if UNITY_LE_4_3
            EditorGUI.indentLevel += 2;
#endif

            //GUILayout.BeginHorizontal ();
            //GUILayout.Space (28);
            if (GUILayout.Button("Modifiers attached to this gameObject are listed here.\nModifiers with a higher priority (higher up in the list) will be executed first.\nClick here for more info", helpBox))
            {
                Application.OpenURL(AstarPathEditor.GetURL("modifiers"));
            }


            EditorGUILayout.HelpBox("Original or All can be converted to anything\n" +
                                    "NodePath can be converted to VectorPath\n" +
                                    "VectorPath can only be used as VectorPath\n" +
                                    "Vector takes both VectorPath and StrictVectorPath\n" +
                                    "Strict... can be converted to the non-strict variant", MessageType.None);
            //GUILayout.EndHorizontal ();

            prevMod = mods[0];

            for (int i = 0; i < mods.Count; i++)
            {
                //EditorGUILayout.LabelField (mods[i].GetType ().ToString (),mods[i].Priority.ToString ());
                MonoModifier monoMod = mods[i] as MonoModifier;

                Color prevCol = GUI.color;
                if (monoMod != null && !monoMod.enabled)
                {
                    GUI.color *= new Color(1, 1, 1, 0.5F);
                }

                GUILayout.BeginVertical(GUI.skin.box);

                if (i > 0)
                {
                    if ((prevMod as MonoModifier) != null && !(prevMod as MonoModifier).enabled)
                    {
                        prevMod = mods[i];
                    }
                    else
                    {
                        if ((monoMod == null || monoMod.enabled) && !ModifierConverter.CanConvert(prevMod.output, mods[i].input))
                        {
                            //GUILayout.BeginHorizontal ();
                            //GUILayout.Space (28);
                            GUIUtilityx.SetColor(new Color(0.8F, 0, 0));
                            GUILayout.Label("Cannot convert " + prevMod.GetType().Name + "'s output to " + mods[i].GetType().Name + "'s input\nRearranging the modifiers might help", EditorStyles.whiteMiniLabel);
                            GUIUtilityx.ResetColor();
                            //GUILayout.EndHorizontal ();
                        }

                        if (monoMod == null || monoMod.enabled)
                        {
                            prevMod = mods[i];
                        }
                    }
                }

                GUILayout.Label("Input: " + mods[i].input, EditorStyles.wordWrappedMiniLabel);
                int newPrio = EditorGUILayoutx.UpDownArrows(new GUIContent(ObjectNames.NicifyVariableName(mods[i].GetType().ToString())), mods[i].Priority, EditorStyles.label, AstarPathEditor.upArrow, AstarPathEditor.downArrow);

                GUILayout.Label("Output: " + mods[i].output, EditorStyles.wordWrappedMiniLabel);

                GUILayout.EndVertical();

                int diff = newPrio - mods[i].Priority;

                if (i > 0 && diff > 0)
                {
                    mods[i - 1].Priority = mods[i].Priority;
                }
                else if (i < mods.Count - 1 && diff < 0)
                {
                    mods[i + 1].Priority = mods[i].Priority;
                }

                mods[i].Priority = newPrio;

                GUI.color = prevCol;
            }

#if UNITY_LE_4_3
            EditorGUI.indentLevel -= 2;
#endif
        }
    }
Exemplo n.º 34
0
	//End Misc
	
	
	/** Enables editor stuff. Loads graphs, reads settings and sets everything up */
	public void OnEnable () {
		
		script = target as AstarPath;
		GUILayoutx = new EditorGUILayoutx ();
		EditorGUILayoutx.editor = this;
		
		//Enables the editor to get a callback on OnDrawGizmos to enable graph editors to draw gizmos
		script.OnDrawGizmosCallback = OnDrawGizmos;
		
		// Make sure all references are set up to avoid NullReferenceExceptions
		script.SetUpReferences ();
		
		//Search the assembly for graph types and graph editors
		if ( graphEditorTypes == null || graphEditorTypes.Count == 0 )
			FindGraphTypes ();

		try {
			GetAstarEditorSettings ();
		} catch (System.Exception e) {
			Debug.LogException ( e );
		}

		LoadStyles ();
		
		//Load graphs only when not playing, or in extreme cases, when astarData.graphs is null
		if ((!Application.isPlaying && (script.astarData == null || script.astarData.graphs == null || script.astarData.graphs.Length == 0)) || script.astarData.graphs == null) {
			LoadGraphs ();
		}
	}