public void DisplayPathOfEnemyGroup(Transform path) { pathPosList = new List <Vector3>(); for (int i = 0; i < path.childCount; ++i) { pathPosList.Add(path.GetChild(i).position + new Vector3(0, 0.2f, 0)); } lineGenerator.Interval = 0.5f; //修改lineGenerator生成物体的距离 lineGenerator.nodePosition = pathPosList; //修改lineGenerator的line的节点集合 lineGenerator.Generator(); //在line上生成物体 }
public override void OnInspectorGUI() { base.OnInspectorGUI(); serializedObject.Update(); GUILayout.BeginVertical("Box"); GUI.skin.label.alignment = TextAnchor.MiddleCenter; GUILayout.Label("Generator"); lineGen.IntervalBetPoints = EditorGUILayout.Toggle("Calcul two point:", lineGen.IntervalBetPoints); //Type intervals lineGen.Interval = EditorGUILayout.FloatField("Interval:", lineGen.Interval); //generation interval lineGen.typePosAndRot = (TypePosAndRot)EditorGUILayout.EnumPopup("Type Pos and Rot:", lineGen.typePosAndRot); //position and rotation of the object lineGen.typeOrder = (TypeOrder)EditorGUILayout.EnumPopup("Order:", lineGen.typeOrder); //type of generation order EditorGUI.indentLevel++; showConstraints = EditorGUILayout.Foldout(showConstraints, "Constraints"); EditorGUI.indentLevel--; if (showConstraints) { GUIFreezeRotAndPos(); } listGUI.DoLayoutList(); //List object serializedObject.ApplyModifiedProperties(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Generator")) //Button generation { Undo.RecordObject(lineGen, "Generator"); lineGen.Generator(); } if (GUILayout.Button("AllDelete")) //Button destroy all object { Undo.RecordObject(lineGen, "Delete"); lineGen.AllDelete(); } GUILayout.EndHorizontal(); GUILayout.EndVertical(); }